Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Problem with conditional expression

(1) ShareShare
ReportReport
Posted on by 757

So I had this that in theory was solved: Solved: Re: Can expressions have conditional? How to set u... - Power Platform Community (microsoft.com)

But now going into testing phase, it stopped working. The situation is this: for my Sharepoint list I have a choice column called "Business type", so Power Automate reads what you select as: triggerOutputs()?['body/Businesstype/Value']. The choices are either "Project Business" or "Standard Business". This determines what has to be used in an Excel file. The Excel columns are called "DiscountforProjectbusiness" "Discuontforstandardbusiness". So I need that if Project Business was selected, then the excel file data should be used "DiscountforProjectbusiness" if not. The other. So, this should be my expression, no? The Apply to each is considering this is inside an Apply to each that has filtered already that Excel table for that particular item I need. 

 if(equals(triggerOutputs()?['body/Businesstype/Value'], 'Project business'), items('Apply_to_each')?['DiscountforProjectbusiness'], items('Apply_to_each')?['Discountforstandardbusiness'])

  But this expression is not doing anything, it's just going blank 😞 Any ideas?

  • WorkingRicardo Profile Picture
    757 on at
    Re: Problem with conditional expression

    I managed to fix it changing the syntaxis of the formula 😄 the problem was with a name of the Excel column. 

  • WorkingRicardo Profile Picture
    757 on at
    Re: Problem with conditional expression

    Hey @Expiscornovus ty for your reply again 😄
    Mmm, dunno if that's the problem, as I've been trying making matches to something I know has a value in the Excel columns.

    Either way, the expression with the empty function would be like this?

     

     if(equals(triggerOutputs()?['body/Businesstype/Value'], 'Project business'), empty(items('Apply_to_each')?['DiscountforProjectbusiness']), empty(items('Apply_to_each')?['Discountforstandardbusiness']))

     

    Let me know if you can think of other things that could be the error. Ty in advance 🙂

     

    EDIT: I ran a Compose action with that, and got this: Captura de pantalla 2024-07-08 092731.png

    What does that mean 😅?

  • Expiscornovus Profile Picture
    31,732 Most Valuable Professional on at
    Re: Problem with conditional expression

    Hi @WorkingRicardo,

     

    What do you want to do when it is empty, which value do you want to present in that case?

     

    You could for example include an empty function in your expression and check for that as well.

  • WorkingRicardo Profile Picture
    757 on at
    Re: Problem with conditional expression

    hey @Expiscornovus ty for your reply.

    Yes, some of the columns are blank. Altough they must remain that way 😞 I'm going to try to test if putting a 0 on them fixes this. I don't want this solution, as this is a very finnicky Excel file that has tendency to go awry whenever I edit anything...

    EDIT: yeah, I tried putting a 0 to the blank rows, and this killed my flow for some reason (the sharepoint wouldn't update in any colun). Also, going to the raw outputs of my Update to sharepoint action, the column I'm trying to update is not even mentioned. Is like PowerAutomate just ignores completely the existence of my command O.o...

    So, could there be another solution?

  • Expiscornovus Profile Picture
    31,732 Most Valuable Professional on at
    Re: Problem with conditional expression

    Hi @WorkingRicardo,

     

    The expression looks ok, maybe it is data related. Does one of your rows in the Excel table have either an empty DiscountforProjectbusiness (or Discountforstandardbusiness) column?

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >