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 Automate
Answered

Can't make IF work

(0) ShareShare
ReportReport
Posted on by 127

What am I doing wrong?

 

if(length(outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])=0, triggerBody()?['contactFirstname'], outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])

 

I keep getting an 'The expression is invalid' error.

Categories:
I have the same question (0)
  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    You should replace "=" by using "equals" function:

    if(equals(length(outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName']),0), triggerBody()?['contactFirstname'], outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])

    Hope it helps!

    Ferran

  • DanielPineault Profile Picture
    127 on at

    No Words, the language doesn't handle simple equalities?!  You need to use a function.  OMG.

     

    At least I learnt something new today.

  • Community Power Platform Member Profile Picture
    on at

    I think generally speaking the '=' sign assigns values to a variable, it does not compare them. When you need to start compare values, the 'equals' function is more appropriate. 

  • DanielPineault Profile Picture
    127 on at

    length() returns explicit numerical values, does it not?

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard