I have tried to filter by a date field and by a choice field, but they both result in an invalid expression error.
For the date field, I write: ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')
and I get: The expression "ExpiryDate le 2018-06-22" is not valid. clientRequestId: 32c616f1-365e-4b8d-b0e7-1913c661f5b5 serviceRequestId: f766709e-8023-5000-d589-a40ee4e3f486
which shows that addDays(utcNow... is working. And ExpiryDate is a date field set to Date Only.
For filtering on a choice, I write: AccountStatus = 'Active'
and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8
In the end, I need to have a compound conditions that ANDs these two together. But first, I would like to have them work separately. For now, I have almost 1,000 rows in my list, but it will double before too long and double again before it is mature.
Solved! Go to Solution.
Hi @RKushner,
For the date filed, I assume that you didn’t add a single quote around the function adddays in the Filter Query filed. Please configure the code under Expression tab then add a single quote around the code. Please take the following screenshot for a reference:
For the AccountChoice field, the code used in the Filter Query filed should be
AccountChoice eq 'Inactive'
And if you want to combine the two code together, please use the following code:
ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd') and AccountChoice eq 'Inactive'
This doc about Filter expressions in Odata URLs could be helpful for you:
https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)
Best regards,
Mabel Mao
Hi @RKushner,
For the date filed, I assume that you didn’t add a single quote around the function adddays in the Filter Query filed. Please configure the code under Expression tab then add a single quote around the code. Please take the following screenshot for a reference:
For the AccountChoice field, the code used in the Filter Query filed should be
AccountChoice eq 'Inactive'
And if you want to combine the two code together, please use the following code:
ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd') and AccountChoice eq 'Inactive'
This doc about Filter expressions in Odata URLs could be helpful for you:
https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)
Best regards,
Mabel Mao
For the date field, that works!!!
But for the Account choice field, that is what I am already doing, and it doesn't work:
I write: AccountStatus = 'Active'
and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8
I think that there is a special syntax for choice fields in conditions...
I am confused because even though AccountStatus = 'Active' doesn't work, putting the two conditions together (like you said, ExpiryDate le 'addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')' and AccountChoice eq 'Inactive') does work!!!