Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

How To add text to a Forms response if a condition is not met via Power Automate's Compose Action

(0) ShareShare
ReportReport
Posted on by 2

I am trying to edit a response in Microsoft Forms before outputting it into an Excel sheet via Power Automate.

 

I am using the "Compose" action in Power Automate to update the contents of a form response.

 

I want it to check if the response does not contain a colon. If it does not contain a colon I would like to insert a colon two characters into the response. If it does contain a colon I want it to return the original phrase. This is what I came up with but I can't get it to work. It entirely bypasses the compose action every time.

 

if(not(contains(triggerBody()?[Question],':')),concat(triggerBody()?[Question],':'),replace(triggerBody()?[Question],':',':'))

 

The responses will be military time in the following formats. I want to correct the responses to all have the colon separator so that they are instantly compatible with the Excel sheet it will be output to.

 

1309

14:50

 

Any guidance would be appreciated 🙂

  • Re: How To add text to a Forms response if a condition is not met via Power Automate's Compose Action

    Hi @alexelise_ ,

    It's so strange. I suggest you recreate the flow and switch to the classic designer to avoid unnecessary loops. And you can directly put the output of compose into Add a row into table without filling in the expression again.

    I did a test for your reference.

    In my scenario:

    My Table:

    vyetonggumsft_1-1710209164331.png

    My Flow:

    vyetonggumsft_0-1710208968577.png

    vyetonggumsft_2-1710209284122.png

    Because the encoding of our Question is different, I don’t recommend you to use my encoding format directly. Please try this expression again.

    if(contains(Question,':'),Question,concat(substring(Question,0,2),':',substring(Question,2,2)))

    Best Regards,

    Sunshine Gu

  • alexelise_ Profile Picture
    alexelise_ 2 on at
    Re: How To add text to a Forms response if a condition is not met via Power Automate's Compose Action

    Hi @v-yetonggu-msft , 

     

    Thank you for your response! I am wondering if you could also help me navigate the next step in my flow as I am assuming adjustments must be made. I also need to add a row to a table in Excel. Now I believe the compose action is working but is just not outputting the edited response in Excel. I have attached pictures of the flow for reference. I know you did not use the "Apply to each" action in your example, but for some reason, Automate will not allow me to have the "Get response details" without auto-applying the action. I tried the flow with only all combinations of the actions being inside the "Apply to each" and got the same results. 

     

    I am assuming I need to adjust what is input in the start time box so that it enters the composed answer instead of the exact response collected from the form. But after messing around with my options I am still unable to execute it. 

     

    Reply 1.pngReply 2.pngReply 3.jpg

  • Re: How To add text to a Forms response if a condition is not met via Power Automate's Compose Action

    Hi @alexelise_ ,

    I did a test for your reference.

    In my scenario:

    vyetonggumsft_0-1709727740755.png

    vyetonggumsft_0-1709729026043.png

     

    if(contains(Question,':'),Question,concat(substring(Question,0,2),':',substring(Question,2,2)))

     

    The ’Question‘ in the expression represents the Question option in the flow. Replace all ’Question‘ in the expression with the Question option.

    vyetonggumsft_1-1709729162094.png

    Best Regards,

    Sunshine Gu

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,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard