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 Automate - General Discussion
Unanswered

Compose expression is invalid - Complex concat() with 44 conditional questions

(0) ShareShare
ReportReport
Posted on by 16
Hey everyone !

I'm building a Power Automate flow that processes Microsoft Forms responses (44 questions total). The flow does the following :
  1. Triggers when a new Forms response is submitted
  2. Gets response details via Get response details action
  3. Parses the JSON response using two separate Parse JSON actions:
    Parse_JSON_1: Contains all 44 form questions (string fields)
    Parse_JSON: Contains file attachments of one of the questions (array)
  4. Uses a Compose action to build an HTML output showing only answered questions (skip empty ones, since there's so many)
  5. Sends this HTML via email to a technician
My problem :
When I paste my expression into the Compose action's Expression field, Power Automate returns "The expression is invalid"

No other error details are provided. I've tried and tested :
  • Pasting in the Expression tab (not Dynamic content)
  • Removing line breaks (entire expression is on one line)
  • Simplifying the structure
  • Asked Claude to review my code
  • Even simpler versions with 2-3 questions doesn't work, so the issue probably is somewhere else
The expression uses concat() with multiple nested if(empty()) statements to conditionally include questions that have answers.

Here a simplified code structure (showing like 3 questions out of 44) (I can't seem to be able to paste the code, even with the code snippet, I'm sorry) :

Just in case, both Parse_JSON_1 and Parse_JSON actions run successfully before Compose and all question IDs are correct (verified via test runs).

So my question is :
Is there a complexity limit for Compose expressions in Power Automate? Or is there a syntax issue I'm missing when chaining 44 if() statements inside a single concat()?


Environment :
  • Power Automate cloud flow
  • Microsoft Forms (Teams group form)
  • Parse JSON with custom schemas
Any help or alternative approaches would be greatly appreciated!

Thanks a lot in advance and have a great day,

 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    51,223 Super User 2025 Season 2 on at
    Compose expression is invalid - Complex concat() with 44 conditional questions
     
    please dont post twice lol 
     
    Please show your flow so I can see your action names also paste the actual content versus only a picture please. will get it resolved way faster.
  • Michael E. Gernaey Profile Picture
    51,223 Super User 2025 Season 2 on at
    Compose expression is invalid - Complex concat() with 44 conditional questions
    Hello @Shortcube
     
    I see many issues, but I cannot tell if its simple copy paste issues or other
     
    There is no reason for it to ever have red under text, for instance your <br>, sure its not closed, but if its surrounded by proper quotes its just a string so something is wrong.
     
    Then I see images.. i cannot tell if thats on purpose or not but I would remove those.
     
    You said only having a couple still fails, but a couple what?
     
    Can you pair it down to the simplest (like 1 answer), with all your HTML concats. If you can do that and paste the in that will be super helpful but the above has too many holes for my eyes to try to just see what's wrong, but I did OCR it out and yeah... need a clean, or what you believe is clean and short.
     
    once we fix one, you adding them back in one at a time will easily show you what you are breaking.
     
     
  • Michael E. Gernaey Profile Picture
    51,223 Super User 2025 Season 2 on at
    Compose expression is invalid - Complex concat() with 44 conditional questions
    Hey put it in a word doc and try to attach it.. hopefully it will come through lol the attachments fail so often
  • Shortcube Profile Picture
    16 on at
    Compose expression is invalid - Complex concat() with 44 conditional questions
    @Michael E. Gernaey
    I apologize for the double post, I'm still trying to figure out the platform lol
     
    I gave you the full code in the attachment, thanks a lot once again for your time
  • Chriddle Profile Picture
    8,307 Super User 2025 Season 2 on at
    Compose expression is invalid - Complex concat() with 44 conditional questions
    I'm quite sure you don't have any problems with technical complexity.
    The problem is rather that the code is unreadable.
    Please use line breaks and code indentation for clarity.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Automate

Last 30 days Overall leaderboard