0

All,

I like to retrieve data from two Lists. The main list is called OIE ALerts. The secondary List is Countries. I like to get the country code for the Country field in OIE Alerts. The country code is the second list.

OIE Alerts, field Country (lookup) = "Nederland" Countries, field LandNaam (single line) = "Nederland", LandCode (single line) = NLD

Found this example but confused how to make it work for me:

var urlForOrderBy = "/_api/Web/Lists/GetByTitle('OIE Alerts')/Items?" +
    "$select=ID,Title,Country,Date_of_Event,LandCode," +
    "SpPerson/Name,SpPerson/Title,SpLookup/Title,SpLookup/ID" +
    "&$expand=SpLookup,SpPerson&$orderby=Date_of_Event desc";
Marco
  • 121
  • 2
  • 3
  • 16

1 Answers1

1

From your explanation I understand that LandNaam and LandCode are in the same list, so this should work: "/_api/Web/Lists/GetByTitle('OIE Alerts')/Items?" + "$select=ID,Title,Date_of_Event,Country/LandCode,Country/LandNaam" + "&$expand=Country&$orderby=Date_of_Event desc"; If LandCode is also a lookup, please refer to this explanation

  • LandName and LandCode are text fields in the List Countries. Country is a lookup field in the main list. – Marco Nov 03 '17 at 18:38