Skip to main content

Notifications

Power Automate - Building Flows
Answered

what's wrong with this if statement....

(0) ShareShare
ReportReport
Posted on by 646

I'm using modern designer and it's saying there's an error in my format.

On the prev action I split a string based on a "space"
This action is called "SplitName"

split(item()?['name'],' ')

I then am inserting into a string DV field...trying to use...

if(length(outputs('SplitName')) > 1, outputs('SplitName')[1],'')

pretty basic stuff...the error is ... This expression has a problem. You can fix it manually or with Copilot.

it would accept length(outputs('SplitName')) but I'm throwing a conditional if in there... basically grab the 2nd item in the array if there's a value.

  • Suggested answer
    sasrsc Profile Picture
    sasrsc 646 on at
    what's wrong with this if statement....
    The final syntax for the record was...

    if(greater(length(outputs('SplitName')), 1), outputs('SplitName')[1], '')
  • Verified answer
    David_MA Profile Picture
    David_MA 9,039 on at
    what's wrong with this if statement....
    The issue is with the ">" character in the expression. That is not valid. I am going by memory and haven't tested this, but the correct expression should be: if(isgreater(length(outputs('SplitName')), 1), outputs('SplitName')[1], '')
     
    You need to use isgreater instead of >
  • Chriddle Profile Picture
    Chriddle 7,371 on at
    what's wrong with this if statement....
    There is no operator ">" in Power Automate expressions.
    Check function greater()

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard