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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert True/False to ...
Power Automate
Answered

Convert True/False to Yes/No

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

Hello!


I am trying to convert True/False to Yes/No where the values have come from a 'Get_item' action.

 

I've tried using this expression however "True" responses are coming back as "No".

 

if(equals(item()?['Q1'], true),'Yes', 'No')

 

For reference, I am populating an MS Word template:

sudosaurus_0-1676656168124.png

 

Categories:
  • abm abm Profile Picture
    33,004 Most Valuable Professional on at

    Hi @sudosaurus 

     

    You could try the following:

     

    if(equals(bool(item()?['Q1'], true)),'Yes', 'No')

     

    Thanks

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @abm 

    I am seeing this error when trying your suggested expression:

    Unable to process template language expressions in action 'Populate_a_Microsoft_Word_template' inputs at line '0' and column '0': 'The template language function 'bool' expects one parameter: the value that is to be converted to a boolean. The function was invoked with '2' parameters. Please see https://aka.ms/logicexpressions#bool for usage details.'.
  • VictorIvanidze Profile Picture
    13,083 on at

    A bracket was in wrong place:

    if(equals(bool(item()?['Q1']), true),'Yes', 'No')

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @VictorIvanidze 

    Still not accepting it:

    Unable to process template language expressions in action 'Populate_a_Microsoft_Word_template' inputs at line '0' and column '0': 'The template language function 'bool' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
  • VictorIvanidze Profile Picture
    13,083 on at

    Create a Compose action and place there item()?['Q1']

    Show the output.

  • abm abm Profile Picture
    33,004 Most Valuable Professional on at

    Hi @sudosaurus 

     

    I did tested this and this expression is good to me

     

    if(equals(bool(item()?['Q1'], true)),'Yes', 'No')

     

    What value you getting from item()?['Q1']?  Open the run history and check the value?

     

    Thanks

    Thanks

  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at
    1. Check if the column exists (and exists in your flow context) by removing the question mark in your expression.
    2. Check if the column is really of type boolean.
    3. Check if your column returns null

     

    If the column is of type boolean and its values are not null, there is no need for function equals().

     

    If this value is possibly null, use function coalsece() to define a default, this makes what you are comparing clearer.

     

    if(
     item()['Q1']
     'Yes',
     'No'
    )
    
    
    if(
     coalesce(item()?['Q1'], false)
     'Yes',
     'No'
    )

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @Chriddle @abm @VictorIvanidze 

     

    For reference, this is the value of Q1 - where the internal name appears to be "_x0051_1":

    @{outputs('Get_item')?['body/OData__x0051_1']}

     

    Do I need to make changes to the above suggestions?

  • VictorIvanidze Profile Picture
    13,083 on at

    Hi @sudosaurus,

    what  

    @{outputs('Get_item')?['body/OData__x0051_1']}

    returns when you run your flow?

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @VictorIvanidze 

     

    I tried using your above expression and the results came back as True.

    sudosaurus_0-1676893872773.png

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard