cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EdHansberry
Kudo Collector
Kudo Collector

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

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
Kudo Collector
Kudo Collector

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.

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!
 

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.

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.

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!

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,383)