Filtering Cross-site Lookup

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
MES5464
Posts: 94
Joined: Mon Aug 26, 2013

14 Feb 2014

Is anyone willing to help me with my cross-site lookup filter?


function (term, page) {

var dt = Date.today();


if (!term || term.length == 0) {

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Occuring,Location&$orderby=Show_x0020_Start,Show_x0020_End&$filter=year(Show_x0020_Start) eq " + dt.getFullYear() + "&$top=100";

}

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Occuring,Location&$orderby=Show_x0020_Start,Show_x0020_End&$filter=startswith({LookupField}, '" + term + "')&$top=100";

}

MES5464
Posts: 94
Joined: Mon Aug 26, 2013

14 Feb 2014

I have been experamenting with other ways to get what I need. While doing so I have attempted to use endswith and substringof in both cases I get the following messages:

The function operator 'endswith' is not not supported or its usage is invalid.

The function operator 'substringof' is not not supported or its usage is invalid.

MES5464
Posts: 94
Joined: Mon Aug 26, 2013

14 Feb 2014

Some of the things I have tried.

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Occuring,Location&$orderby=Show_x0020_Start,Show_x0020_End&$filter=endswith({LookupField}, '2014')&$top=100";


return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Occuring,Location&$orderby=Show_x0020_Start,Show_x0020_End&$filter=substringof({LookupField}, '2014')&$top=100";

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

16 Feb 2014

Hello,

It seems, MSDN guidance contains incorrect samples. Try the following code:

Code: Select all

function (term, page) {
  var dt = new Date();
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,\  
    {LookupField},Occuring,Location&$orderby=Show_x0020_Start,Show_x0020_End&\
    $filter=Show_x0020_Start gt datetime'" + dt.getFullYear() + "-01-01T00:00:00Z'&$top=100";
  }
...
}
Please, read the following article:
http://neganov.blogspot.ru/2013/06/filt ... using.html

MES5464
Posts: 94
Joined: Mon Aug 26, 2013

17 Feb 2014

Thank you!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests