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 / How to use Concat func...
Power Automate
Answered

How to use Concat function when there are empty values (I have 3 fields and I don't want to concat then when empty)

(0) ShareShare
ReportReport
Posted on by 11

Hi All,
I have around 3 fields from a sharepoint list e.g returning "Boy", "Girl", "Daddy".
I would like to have then concatenated into a single field like so Boy.Girl.Daddy  - FYI i also need the dot in that format

If for example a value is empty let's say Girl it should be Boy.Daddy

Any idea how I can achieve this using power automate?

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @naijacoder1 ,

     

    I have made a simple test for your reference.

     

    concat(if(empty(items('Apply_to_each')?['ColumnA']),'',concat(items('Apply_to_each')?['ColumnA'],'.')),if(empty(items('Apply_to_each')?['ColumnB']),'',concat(items('Apply_to_each')?['ColumnB'],'.')),if(empty(items('Apply_to_each')?['ColumnC']),'',items('Apply_to_each')?['ColumnC']))
    if(equals(slice(outputs('Compose'),add(length(outputs('Compose')),-1)),'.'),substring(outputs('Compose'),0,add(length(outputs('Compose')),-1)),outputs('Compose'))

     

    vyujincuimsft_0-1663651740794.png

    Result Screenshot:

    vyujincuimsft_1-1663651787325.png

     

     

    Best Regards,

    Charlie Choi

  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @naijacoder1 

    I was able to solve your problem. Though my method is pretty long. There could be shorted methods too.

    Here is the Input:

    Sundeep_Malik_0-1663651737360.png

    Here is the final Output:

    Sundeep_Malik_1-1663651755702.png

    I firstly initialized an array with your input.Then created a new array of array and after that made an empty string variable.

    Sundeep_Malik_2-1663651889947.png

    Then used an apply to each method, and passed the variable A in it. And then matched each item with the empty variable. If its not empty I am just appending it to the Array variable B.

    Sundeep_Malik_3-1663651954882.png

    After this I stored the above array in a compose and made another variable called FinalOutput.

    Sundeep_Malik_4-1663651996750.png

     

    Then I used another apply to each method and passed variable B in it.

    And appended the current item in the final output string with a dot at the end.

    After that I used another compose to remove the last dot from output. Actually I am getting Boy.Daddy., to remove the last dot I am using the substring method.

    It formula:

    substring(variables('FinalOutput'),0,sub(length(variables('FinalOutput')),1))
     

    Sundeep_Malik_5-1663652061751.png

    I hope this helps.

  • naijacoder1 Profile Picture
    11 on at

    Thanks Charlie for the help.
    I will give it a shot and let you know

  • naijacoder1 Profile Picture
    11 on at

    Hi Charlie,
    Sorry but unfortunately i'm getting this error below .

    naijacoder1_0-1663720858462.png

     

  • v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @naijacoder1 ,

     

    Could you please provide some screenshots of your Flow setting? That will make it much easier to assist.

     

    The Outputs of the first Compose Action should be a string.

    vyujincuimsft_0-1663724462572.png

     

     

    Best Regards,

    Charlie Choi

  • naijacoder1 Profile Picture
    11 on at

    Thanks Charlie .I will do that soon

  • naijacoder1 Profile Picture
    11 on at

    Please see below

    I need help with Compose 2

    naijacoder1_0-1663753754524.png

    Thanks

     

  • v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @naijacoder1 ,

     

    Based on the screenshot you provided, the first Compose Action seems to return the expected result.

    The expression in the second Compose Action is to determine whether there are extra dots at the end of the string that need to be removed.

    Could you please tell me what is the problem you are currently encountering? Is there any other error message.

     

     

    Best Regards,

    Charlie Choi

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 671

#3
Haque Profile Picture

Haque 551

Last 30 days Overall leaderboard