Filtering Cross-site Lookup

rss

Posted by MES5464 - Feb 14 ’14 at 04:48

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
    Member
    Member for: 10 years 29 days
    #1 by MES5464 Feb 14 ’14 at 05:28

    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
    Member
    Member for: 10 years 29 days
    #2 by MES5464 Feb 14 ’14 at 05:44

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 10 years 4 days
    #3 by Dmitry Kozlov Feb 16 ’14 at 06:59

    [#2]: Hello,

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

    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/filtering-items-by-date-range-using.html

  • MES5464
    Member
    Member for: 10 years 29 days
    #4 by MES5464 Feb 17 ’14 at 11:09

    Thank you!

  • peter0900
    Member
    Member for: 10 months 16 days
    #5 by peter0900 Apr 6 ’23 at 12:09

    By choosing the view option in the lookup field, you can focus on a portion of the items in a target list, which will help you narrow down your choices.
    USA Best Photographers

Displaying 1 to 5 of 5 messages