cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Advanced edit condition

I am REALLY hoping someone can help me out.

What started this journey to advanced conditions is that I was running into a problem where Flow was telling me that it was unable to process template language expressions (https://powerusers.microsoft.com/t5/I-Found-A-Bug/Unable-to-process-template-language-expressions-in... )

All I'm really trying to do is use the value of a cell (Excel table) in my condition logic. It worked once when I wrapped my value in ' ' but for some reason didn't work for the other threshold I added in the no branch. Thus, I pivoted to Advanced edit. 

This is what I have so far, but the error message I get back here is a generic 'Invalid Response'

 

The syntax I'm (trying) to use are the following

less(float( body('Get_a_Row')?['output'] ),3)

less(float( body('Get_a_Row')?['output'] ),6)

greater(float( body('Get_a_Row')?['output'] ),6)

 

I linked the aforementioned screenshots of the error message & then the structure of my flow. Trying to use the output of 'Get Rows' for the condition

screenshots 

1 ACCEPTED SOLUTION

Accepted Solutions

I know you are all DYING to know the outcome lol. I am happy to report that I got this working. I put the logic in the Excel sheet that I was trying to use in Flow. The output of that was the text "Less3" "Less6" "Greater6" as suggested. I added this row to the Table, with its own special Power Apps ID to be used as dynamic content in my Flow. I like the Switch model the best, so that's what my production Flow uses.

Thanks again for all the help, this was a tricky one!

View solution in original post

19 REPLIES 19
edgonzales
Most Valuable Professional
Most Valuable Professional

@Caitlin_Knox1 

Hi there!  Wow, so much to unpack here.  Great job documenting everything, btw.

Ok, so I want to step through the simple stuff first.  Can you please post the json output of the Get Row step?  I'm guessing there's a column called 'Output', right?  So, specifically that field.  Once I have that, I can start mocking up some things.

 

Thanks!

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Thank you for replying! I've been battling this all week and would love to get it wrapped up. I so appreciate you.

 

Just some context on the logic. There are 3 different conditional branches. one for under 3, one for under 6 (greater than 3, less than 6) and then greater than 6. This specific value 46.9 i would expect to generate the 3rd templated email for greater than 6

 

JSON output from ‘Get Row’ action

{

  "@odata.context": "https://excelonline-eus2.azconn-eus2.p.azurewebsites.net/$metadata#drives('b%21dcKhzg3g-0yr_gL8uGcIi...",

  "@odata.etag": "",

  "ItemInternalId": "8IpkptcFiKG",

  "__PowerAppsId__": "8IpkptcFiKG",

  "Attribute": "Months to Pay Back",

  "Output": "46.9"

}

@Caitlin_Knox1 

No worries at all.  This is a fun challenge and it feels like we can sort it out pretty quick.  I see you're using a variable for the 'eMail sent' check...is that on ALL of the paths?  If so, what do you think of this approach:

 

First, have a condition that checks the email sent.  If True, then probably a much shorter path, right?

 

If that value is False, then do a Compose which defines a "Path Label" depending on the Output value.  For this, I stole an old Excel trick and just nested a couple of IF statements.  There are probably more elegant ways, but this works so far.  The expression looks like this:

 

if(equals(less(float(outputs('Sample_Output')?['Output']),3),true),'Less3', if(equals(less(float(outputs('Sample_Output')?['Output']),6),true),'Less6','Great6'))

 

(If the output is less than 3, it labels it "Less3", if it's not, we look to see if it's less than 6, and if it's not, then we default to "It must be bigger than 6")

 

Then do a Switch on the path label, which will give you the ability to have more than two paths.  Here's what that looks like:

20191109a.PNG

 

Let me know if that helps.  Keep us posted.

 

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

 

Would I put the Path action here (see image with red arrow) IMAGE 

dejavu

 

Same error message as before with the compose action

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2039': 'The template language function 'float' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

I did have to modify this formula to 

if(equals(less(float(outputs('Get_a_Row')?['Output']),3),true),'Less3', if(equals(less(float(outputs('Get_a_Row')?['Output']),6),true),'Less6','Great6'))

because I got an error message that 'Sample_Output' couldn't resolve to the template

current setup: screenshot 

I realize I can remove the conditions in each case, It just deletes all subsequent actions- So once I get it working, I will tidy it up and add the condition above the compose action as you suggested.

@Caitlin_Knox1 

Is the error showing on the updated/new Compose?  If you haven't deleted the older bits, I wonder if the error is just a remnant from that stuff.  Which step is highlighted on the error?  It looks like it's taken care of in the "current view" image, but I don't like to make too many assumptions.  Also, the sample data that you gave, was that from a run that errored out?  I'm wondering if there's a weird value in the Output column of the row you are selecting.

 

You are correct in the placement (red arrow)., and I think we're very close.

 

-Ed-

Yes, its showing on the Compose action. The current view image shows the architecture when it failed on the compose action. What do you mean by deleting older bits? The only thing prior is an action to print an excel worksheet to pdf

 

screenshot 

 

also, here's an image of what the source table looks like. I have tried changing the data type to number, general, and text. All with the same error of being unable to process the template language  source table.PNG

"Older bits" was in reference to previous iterations of the flow build.  You got it cleared out, it looks like from the screenshot, but I was just making sure it wasn't erroring out on something old.

 

Ok, so now we want to see if the sample data you sent from the earlier post was from the same row.  Can you post the output from the Get a Row step if it's a different row?  Also, I haven't worked with spaces too much before...do we know if the underscores in the Get_a_row part are messing anything up?  If it's in the single quotes, they may not be necessary. I'll  try that real quick, as well.  - nm, I confirmed the underscores are ok.  🙂

Here's the output, it is the same

 

{
"@odata.etag": "",
"ItemInternalId": "8IpkptcFiKG",
"__PowerAppsId__": "8IpkptcFiKG",
"Attribute": "Months to Pay Back",
"Output": "46.9"
}
 
Tried removing the _ and get this error: 
The template validation failed: 'The action(s) 'Get a Row' referenced by 'inputs' in action 'Compose' are not defined in the template.'.
 
I do think its required for the spaces

@Caitlin_Knox1 

Ya, I saw the underscores on my steps so now I know 🙂

 

So, I'm glad you posted a screenshot of the table.  Can we confirm that when you click on the value in the _PowerAppsID_ column, the Table name is the same as when you click on the corresponding Output value?  Check the "Design" tab, and the table name is in the upper left (see below):

 

20191109b.PNG

 

Part of me wonders if you've got two separate tables next to each other, and the Float() has no idea what 'Output' is since it's not in the same table.  Or you could have one table formatted weird.  But check the table name to be sure.  I mean, I can see "output" in the JSON, but just want to check all the angles, you know?

 

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Yes, the table names are the same

Capture4.PNG

Ya, I knew it was a stretch...  Still looking at this, but try this while I'm building a table to match yours:

 

if(equals(less(float(string(outputs('Get_a_Row')?['Output'])),3),true),'Less3', if(equals(less(float(string(outputs('Get_a_Row')?['Output'])),6),true),'Less6','Great6'))

Same error. I'm going to rebuild from scratch. There's got to be some change I made that Flow couldn't update or something that's corrupting it.

 

Capture.PNG

Really weird.  Ok, ya.  I'll hold off until I hear back.

I am still going in circles here. I created a compeltely new excel file, new table- and ended up back to using the UI less than operators. This is the original reason why I pivoted to advanced condition but, I'd like to see if there's something I can do here in order to exhaust all the efforts in my head.

I've had to wrap my values in '' to get it to actually run successfully and I'm sure that is why now, the logic is not accurate. The Condition 2 is 'Greater than 3' AND 'Less than 6'. You can see the Output number is 46.9- so this condition result should be false.

I've tried it where the output value is under 3, and the first condition checks accurately that its true. BUt can't get the second condition to work for the different threshold

 

Capture.PNG

***NEVERMIND*** no matter the value of the cell, it always goes to the last condition. So even for 1 or 4 from that ActualOutput field, its always rendering True for Greater than 6. Back to square one

 

I got this working. Still think it should have worked the other way you suggested, as logically it made more sense. I don't know, I wish someone from Flow could pipe in and explain it to us.

What ended up working is adding a Compose action as the first step in the Apply to Each. The value of the first Apply to Each is from the List rows present in a table, and the input for the Compose is the value from the Get a row action.

Then I used my original syntax but with 'Compose' instead as well as making them both string data types in my condition statement.

less(string('Compose'),string(3))
less(string('Compose'),string(6))
greater(string('Compose'),string(6))
 
Final Solution.PNG
 

That is absolutely bonkers.  How is Less even working when comparing to Strings?  Makes no sense to me.  I know that it's working, but agree it would be good to get official input.  @v-bacao-msft any thoughts?

 

-Ed-

 

I am still looking for a solution here...any thoughts?

I know you are all DYING to know the outcome lol. I am happy to report that I got this working. I put the logic in the Excel sheet that I was trying to use in Flow. The output of that was the text "Less3" "Less6" "Greater6" as suggested. I added this row to the Table, with its own special Power Apps ID to be used as dynamic content in my Flow. I like the Switch model the best, so that's what my production Flow uses.

Thanks again for all the help, this was a tricky one!

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages