Hi all, I have run into this strange issue where I cannot convert Kusto query results into integers with combo of expression and Data Operation in Power Automate.
First, I wrote this Kusto Query:
Cluster URL: https://hwinventory.kusto.windows.net/
Database: hwinventory
Query:
Dbd
| where ExpectedBinId startswith "ZQZ24"
| where State == "WaitingDestruction"
| summarize Age = now() - min(CreatedTime)
| project Age = toint(format_timespan(Age,"d"))
| project Age = iif(isempty(Age), 0, toint(Age))
And then I added another step: Data Operation → Compose, using formula "int" in the Expression to compose the result of the query above. To clarify it, I could not use the query results in the flow directly, which is why I had to compose them.

When I run the flow, I would always get this error message saying that:
Action 'Convert_Bin_Age_of_ZQZ22_to_Integer' failed.
Unable to process template language expressions in action 'Convert_Bin_Age_of_ZQZ22_to_Integer' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
I also tried changing the last line of my Kusto query to:
| project Age = iif(isempty(Age), "0", tostring(Age))
but I got the same error message. I am pretty sure my query is fine because it runs okay in Azure Data Explorer.
I could not for the life of me figure out what went wrong. I believe I composed my steps correctly and start to wonder there's something wrong with Power Automate. Would highly appreciate it if somebody can help me out here.