web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot convert a value...
Power Automate
Answered

Cannot convert a value from Kusto Query to integer

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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.
siwfy_0-1660360805508.png

 

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.

Categories:
I have the same question (0)
  • Verified answer
    siwfy Profile Picture
    Microsoft Employee on at

    Seems the issue was caused by the feature that when query results are composed in the flow, they come with the title. What I need to do is use split formula to extract the number from the query result first and then convert it to an integer. Simple as that.

  • v-jefferni Profile Picture
    on at

    Hi @siwfy ,

     

    Please consider accept you reply as solution so other uses will be able to find it quickly.

     

    Best regards,

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard