cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
EdHansberry
Level: Powered On

Passing a value from Power Query to a condition in Flow

I have a very simple query in Power Query in flow that provides a row count for a table based on certian critera. Right now I have it it as just a value (that is what Power Query in Power BI/Excel see it as) but when I pass it to a Condition in Flow, it gives the error that it is expecting an integer or decimal number, not an object.

 

How can I write a flow that simply evaluates a row count, and if the row count > 0 then do something, otherwise do nothing.

 

I cannot get past the condition step. I already have my Yes/No steps written. Below is how my flow looks right now. I have it as an "object" per Flow, the object "0" I guess. The condition bombs. How can I convert this to an integer so the condition can work with it? I've tried "start with" or "equals" or "greater than" but all conditions fail.

 

I am unable to even type other functions in the Condition box to do a conversion. I suspect I am supposed to do the conversion before the Condition, but no clue how. Tried int(objRowCount) and that just gave an error.


20190917 17_10_22-Edit your flow _ Microsoft Flow - Microsoft Edge.png

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Passing a value from Power Query to a condition in Flow

Hi @EdHansberry 

 

This is because the "Transfer Data using Power Query" returns an object. For accessing the integer out of it, can you try out the below expression? 
 
Expression: body('Transform_data_using_Power_Query')['Value']
MicrosoftTeams-image (75).png

 

I carried out a test on my side and using the expression in condition worked.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
 

View solution in original post

6 REPLIES 6
EdHansberry
Level: Powered On

Re: Passing a value from Power Query to a condition in Flow

By the way, this was working before I put in a condition. It would post the object "0" (or whatever the value of the row count was) to Teams successfully using the FlowBot, but I want to suppress the posting if the rowcount is zero. So a but stumped.

Dual Super User
Dual Super User

Re: Passing a value from Power Query to a condition in Flow

Hi @EdHansberry 

 

This is because the "Transfer Data using Power Query" returns an object. For accessing the integer out of it, can you try out the below expression? 
 
Expression: body('Transform_data_using_Power_Query')['Value']
MicrosoftTeams-image (75).png

 

I carried out a test on my side and using the expression in condition worked.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
 

View solution in original post

EdHansberry
Level: Powered On

Re: Passing a value from Power Query to a condition in Flow

Thanks. That solved the condition issue, but then the results of the query were no longer available as dynamic content for the condition action.

 

So I created a variable, and used your expression above to assign the row count object to the variable, and then report the variable in Teams via the flow bot.

 

Much appreciated. I'd have never suspect to use "body" to do the conversion.

EdHansberry
Level: Powered On

Re: Passing a value from Power Query to a condition in Flow

By the way, if you know of any good Power Query references for Flow I'd appreciate links. I am experienced in Power Query so building one is no problem. Would just like to understand multiple ways to get the results into formats or data types that can be emailed, posted to Teams, etc. I now have scalar values down. Next would be arrays (tables). I've done some googling and didn't see much on it that was useful to my scenario.

Dual Super User
Dual Super User

Re: Passing a value from Power Query to a condition in Flow

Hey @EdHansberry 

 

The thing to understand for the results returned from actions, is basically the format and the way to extract it. The procedure I follow is first get to know the output format and then use the appropriate functions to get required value. There are a number of built-in functions which allows us to do manipulations over the data like spit,first,last etc. This totally depends on how you want to perform the operation. In the dynamic content doesn't show the keys that you want to use, you can apply a modification, sometimes, Parse JSON and Compose actions are of huge help in these cases. 
 
To get more help on the expressions, you can refer:
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
EdHansberry
Level: Powered On

Re: Passing a value from Power Query to a condition in Flow

Thank you very much @yashag2255  - I've bookmarked each of these links and will review. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,680)