web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / If Statement in Expres...
Power Automate
Unanswered

If Statement in Expression not Returning Expected Results

(0) ShareShare
ReportReport
Posted on by 1,044

Hello. I've tried for hours to get a text field in an html table to show "Yes', when it's value is yes in the SharePoint list and '' (no value) when the value is "No'.

 

I've initialized a string variable to: 

 

 

 

if(equals(item()?['SetListtxt'], 'Yes'), 'Yes', '')

 

 

 

As a test I added the actual field so I can ensure it's working.

It should view in the HTML table as: [dynamic field value]/[variable] so: Yes/Yes, No/   , etc. but all I'me getting is Yes/  , No/  menaing the variable expression is not working and I dont underdtaand why. I thought it was supposewd to bew as simple as Excel if statements but this is furthest from. 

 

HELP

 

I've included pertinent images for reference.

 

Thanks 

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: If Statement in Expression not Returning Expected Results

    Hi @CW ,

     

    Your expression should be used in action 'Create html table' instead of the 'init variable' action because item() function should be used in a loop.

    vxiaochenmsft_0-1670295115462.png

     

    Best Regards,

    Wearsky

  • CW Profile Picture
    1,044 on at
    Re: If Statement in Expression not Returning Expected Results

    Tx for your reply, very much appreciated. 

    I tried using the same expression in the create table but it kept saying the expression was wrong (????).
    Why does MSFT have to make EVERYTHING so difficult. If it knows it's wrong, and intellisense has enough to understand whether it's wrong or right then it should provide the proper or corrected expression or at least example.
  • v-xiaochen-msft Profile Picture
    on at
    Re: If Statement in Expression not Returning Expected Results

    Hi @CW ,

     

    Could you share some screenshots?

     

    Best Regards,

    Wearsky

  • CW Profile Picture
    1,044 on at
    Re: If Statement in Expression not Returning Expected Results

    Actually what I did was create a new line (header/data) and used this expression:

     

    If(equals(item()?['SetListtxt'], 'Yes'), 'Yes', ' ')

     

    which worked perfect.

     

    Thanks for the suggestion to put it in the Create Table action. 

    I think initially my expression was incorrect. Maybe a ')' in the wrong spot but all working good now. 

    Thanks

     

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard