Filtering Cross-site Lookup
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";
}
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";
}
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.
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.
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";
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";
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
It seems, MSDN guidance contains incorrect samples. Try the following code:
Please, read the following article:
http://neganov.blogspot.ru/2013/06/filt ... using.html
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";
}
...
}
http://neganov.blogspot.ru/2013/06/filt ... using.html
-
- Information
-
Who is online
Users browsing this forum: No registered users and 17 guests