FIlter out inactive lookup values
-
- Posts: 2
- Joined: Sat Nov 24, 2018
I have a Cross Site Lookup field looking up entries in a source table. The field also filters out lookup values based on the value of another field already Unit -> Equipment
So, customer wants to load a new list of equipment to use, and of course there are records that are already associated to the current Equipment so they need to stay in the table and be "deactivated"
Add a field to Equipment Called Active set current entries to FALSE, load new with Active = TRUE
So would this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + "&$top=10"
Simply become something like this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"
Thanks
So, customer wants to load a new list of equipment to use, and of course there are records that are already associated to the current Equipment so they need to stay in the table and be "deactivated"
Add a field to Equipment Called Active set current entries to FALSE, load new with Active = TRUE
So would this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + "&$top=10"
Simply become something like this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"
Thanks
Hi!
I'm terribly sorry for a late reply.
Please do not forget to add "Active" field name to the "select" section, something like this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id,Active&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"
I'm terribly sorry for a late reply.
Please do not forget to add "Active" field name to the "select" section, something like this:
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id,Active&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"
-
- Information
-
Who is online
Users browsing this forum: No registered users and 15 guests