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";

1 Answer 1

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

1
  • LandName and LandCode are text fields in the List Countries. Country is a lookup field in the main list.
    – Marco
    Commented Nov 3, 2017 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.