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 / Writing expressions wi...
Power Automate
Unanswered

Writing expressions with if

(0) ShareShare
ReportReport
Posted on by 11

Hello, 

 

I'm new to writing Expressions in flow and am trying to use an if statement to populate data in a list item.

 

Using Microsoft Forms, I collect the following data:

 

  • Funding Source 1 Name - Text
  • Funding Source 1 Speedchart - Text
  • Funding Source 1 % - Number
  • Funding Source 1 State or Federal - Radio choice of State or Federal

If Federal is selected, the following information is also collected

 

  • Funding Source 1 Activities Justification - Text
  • Funding Source 1 Time and Effort Justification - Text
  • Funding Source 1 Grant Manager Email - Email

This data is replicated for up to 3 potential funding sources. 

 

I have a Flow that when this form is submitted, a new item is created in a List

I have a separate, approval flow that starts when a new item is added in that List. 

Once approvals are completed and statuses updated, this data is used to populate other forms. 

 

When flowing from the form to the list, I pipe in all that data as it stands and it maps pretty cleanly 1:1. However, I also need to (when applicable) feed the federal data to a second set of fields (that aren't on the form) like Federal Source 1 Name, Federal Source 1 Speedchart etc. etc. 

 

If a user lists 3 funding sources on a form and all are state, these fields won't be needed in the list item. If the first two funding sources are state and the third is federal, then all the fields related to the 3rd source also need to become the data for all the federal source 1 fields. 

 

I'm basically trying to write an expression to fill in the data of Federal Source 1 Name that says "If Funding Source 1 State or Federal = Federal, fill this with Funding Source 1 Name, else leave blank." I just don't know the syntax of how to do this at all. Can anyone assist?

 

Thank you!

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @rzaddTDOE:

     

    Here is an example of what I think you want:

    In my example, if varString1 or varString2 is equal to Federal, then the result is Federal, otherwise an empty string is returned.  Subsitiute your column names from Dynamic properties for my variables.

    My example uses an if(), or() and equals() expressions.


    if(or(equals(variables('varString1'),'Federal'),equals(variables('varString2'),'Federal')),'Federal','')

     

    If this addresses your issue, please mark your post as Solved.

     

    Scott

  • rzaddTDOE Profile Picture
    11 on at

    Hi Scott,

     

    Thanks for the quick reply. That's not quite the scenario but I tried to use your syntax to modify what I need and I'm receiving an error. 

     

    I'm trying to decide if the field "Federal Source 1" should be populated or left blank. The field "Funding Source 1 State or Federal" is what determines that. If that field contains "Federal" then "Federal Source 1" should display the value for "Funding Source 1". If that field contains "State" then "Federal Source 1" should be blank. 

     

    I tried the following: 

    if(equals(variables(body('Get_response_details')?['rc0f153886965436dbb1eac77daee3148']),'Federal'),body('Get_response_details')?['rb043b14f87d44d5d9d9b7487a8713798'],'')
     
    I did not type in the word "body" but it appeared when I chose the dynamic content. I was going for the following:
    if(equals(variables(Funding Source 1 State or Federal),'Federal'),Funding Source 1,'')
     
    I received the error: "The template validation failed: 'The template action 'Create_item' at line '1' and column '2423' is not valid: "The template function 'body' is not expected at this location.".'.
     
    Any ideas?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard