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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Append String Variable...
Power Automate
Answered

Append String Variable with Concat and If Statement.

(0) ShareShare
ReportReport
Posted on by 14

I am having an issue with appending a string variable.  I can get the expression to work with just the concat or just the if statement but not both combined.  The if statement needs to be inside the concat.

 

This is the If statement that works:

 

 

if(empty(items('Apply_to_each')?['End_x0020_Year']),concat(items('Apply_to_each')?['Start_x0020_Year'],'/',items('Apply_to_each')?['End_x0020_Month/Value']),concat(items('Apply_to_each')?['Start_x0020_Year'],'/',items('Apply_to_each')?['End_x0020_Year']))

 

 

 This is the concat that works:

 

 

concat('<!DOCTYPE html>
<html>
<head>
<style>
table {
 font-family: arial;
 Font-Size: 12pt;
 border-collapse: collapse;
 width: 100%;
}
</style>
</head>
<body>
<table width="99%">
<tr>
<td width="33%" style="border:none !important"><b>****IF STATEMENT NEEDS TO GO HERE****</b></td>
<td width="33%" style="border:none !important"><b>',items('Apply_to_each')?['Employer'],'</b></td>
<td width="33%" style="border:none !important"><b>',items('Apply_to_each')?['Job_x0020_Title'],'</b></td>
</tr>
<tr>
<td colspan="3" width="99%" style="border:none !important">',items('Apply_to_each')?['Description'],'</td>
</tr>
</table>
</body>
</html>')

 

 

 

Here is the Apply to each in the workflow.

Screenshot 2023-10-26 150756.png

 

Any help would be great.  Thanks.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at

    Hi @cfuka 

     

    You mention it doesn't work, but do not give details on what exactly doesnt work. Can you detail out what doesnt work so we can help you fix that 🙂


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • cfuka Profile Picture
    14 on at

    @FLMike The issue is when I place the if statement inside the concat statement.  The output comes out like this.

     

    Screenshot 2023-10-26 160233.png

  • Verified answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at

    @cfuka 

     

    Perfect. Ok the reason is, because you are adding the If statement as text not as an actual expression.

    that is why it's happening.

     

    can you please paste your entire concat when you have the if also. since it see's it as text instead of an expression within an expression thats what the issue is.

     

    Here is mine (my compose)

    you can see it sees it as an expression

    FLMike_0-1698361831761.png

     

    Here is my total and then the output

    FLMike_2-1698361916961.png

     

    FLMike_1-1698361901711.png

     

    So we just need to make sure how you are typing it in to make sure it sees it as an expression in an expression versus text


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Verified answer
    cfuka Profile Picture
    14 on at

    @FLMike Thanks for the help.  This got me thinking of what i was doing differently.  What I was trying to do was something along these lines. 

    concat('
     if(
     empty(),
     concat(''),
     concat('')
     )
     ')

     What I needed to do was this instead.

    if(
     empty(),
     concat(''),
     concat('')
     )

    Now it is working perfectly.  Thanks for the help again.

  • Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at

    Sorry confusing threads, so gad you got it working.. 

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard