Re: Lookup column with date filter
Posted: 21 Mar 2018
Dear Jacob,
This might be part of the problem, but not the critical one, at least the filtering should still work, even if dates do not match. The dates do not match, because of the time difference. When you transform date to ISO format, like we do in the code, it automatically switches timezone from your local one to UTC (aka GMT), that causes time to go over midnight and date to change. This can be fixed, but for now, it's more important to ensure that the filtering works properly.
If you didn't change the name in the Source List, then please correct the code to keep using the original name:
This might be part of the problem, but not the critical one, at least the filtering should still work, even if dates do not match. The dates do not match, because of the time difference. When you transform date to ISO format, like we do in the code, it automatically switches timezone from your local one to UTC (aka GMT), that causes time to go over midnight and date to change. This can be fixed, but for now, it's more important to ensure that the filtering works properly.
If you didn't change the name in the Source List, then please correct the code to keep using the original name:
Code: Select all
function (term, page) {
var vergaderdatum = fd.field('Vergaderdatum').value();
if (vergaderdatum)
vergaderdatum = "Datum_x0020_overleg eq datetime'" + new Date(vergaderdatum).toISOString() + "'";
else
vergaderdatum = '';
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Datum_x0020_overleg&$filter=" + vergaderdatum + "&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField},Datum_x0020_overleg&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and " + vergaderdatum + "&$top=10";
}