Reputation: 193
I am new to logic app and try to build and logic app to check the records in Azure table. The PartitionKey is a string type of DateTime.utcNow().Ticks. I want to write a filter query to filter the records whose PartitionKey is less than or equals to current DateTime. My effort is shown in the screenshot:
It keeps telling me the expression is invalid. Can anyone give me some hints to write the correct query for my purpose? Many thanks. I am not sure why this expression is invalid.
Upvotes: 0
Views: 9204
Reputation: 193
Thanks for George's hint, I just need to add single quote rather than using the string()
. This will help me convert the ticks value to string so that I can compare it with the PartitionKey field.
In this way, it performs the same as this table query for me:
string currentDateTime = DateTime.UtcNow.Ticks.ToString();
TableQuery<EmailTableEntity> rangeQuery =
new TableQuery<EmailTableEntity>()
.Where(TableQuery.GenerateFilterCondition
("PartitionKey", QueryComparisons.LessThanOrEqual, currentDateTime));
Upvotes: 1
Reputation: 14324
Firstly your filter query expression, the format should be Timestamp le datetime'2019-03-18T06:07Z'
.
Second the expression doesn't need the ticks
function, if use it the query expression will be like the below pic hows.
So actually the right query expression should be Timestamp le datetime '@{utcNow()}'
, if you get the warning, go the code view mode change the expression and don't forget the single quote.
And here is my test result, hope this could help you, if you still have other problem please feel free to let me know.
Upvotes: 3