cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Displaced_2000
Frequent Visitor

building an expression using concat

Hello,

I've built a flow which is triggered by a form.  On the form I collect property type (House) and number of bedrooms (5) and create an item on a sharepoint list

I then concat those answers together to get House5

I would like to use House5 as part of the expression below to retrieve a value from another sharepoint list

outputs('Get_item')?['body/House5']

And so if the form answers were Flat and 2 the resulting expression would then read as -

outputs('Get_item')?['body/Flat2']

I then want to retrieve that value.

 

Many thanks for any help.

 

3 ACCEPTED SOLUTIONS

Accepted Solutions

Ok Understood. Reason your compose isn't working because its not an expression. Its a plain text.

 

This is definitely not straight forward since you would like to make it dynamic. Best Option is to leverage REST APIs where you can manipulate string payload and write that in select clause.

 

There is one other option possible using Get Items. See below if it can be of help ..

 

PrasadAthalye_0-1619784854037.png

 

Below is my expression for item... 

 

item()?[ variables('DyamicColumn')]

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

Displaced_2000
Frequent Visitor

Many thanks for your support with this issue.

I tried to adopt your suggestion above using the SELECT function but I wasn't able to see how it would work in my scenario.

 

I've managed to sort my issue, albeit probably not in the most eloquent way.  I've nested if statements. It looks a mess but does what I need it to do for now.

 

Thanks again for your help.

 

 

if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House6'),outputs('Get_item_LA')?['body/House6'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House5'),outputs('Get_item_LA')?['body/House5'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House4'),outputs('Get_item_LA')?['body/House4'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House3'),outputs('Get_item_LA')?['body/House3'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House2'),outputs('Get_item_LA')?['body/House2'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House1'),outputs('Get_item_LA')?['body/House1'],''))))))

 

  

View solution in original post

@PrasadAthalye  I went back and revisited your suggestion using select and finally figured it out, which has given me a cleaner solution which is more understandable for other users when reviewing the flow.

 

So for anyone else with a similar issue, this is what I've ended up doing to achieve my desired outcome.

 

Displaced_2000_0-1620204375824.png

Displaced_2000_1-1620204422646.png

Displaced_2000_2-1620204458202.png

int(first(variables('Get LA Value'))?[outputs('PROPBEDS')])

 

Many Thanks

 

View solution in original post

6 REPLIES 6
PrasadAthalye
Community Champion
Community Champion

You can concat like this using Compose and then use Compose wherever you would like... In the below example, I am concatenating answers from 2 questions. Since your 2nd question is Int, May be you can convert it to string by wrapping it in string ( ) function.

concat(outputs('Get_response_details')?['body/rd7f84d633bd24b01bd831a1128630b83'], outputs('Get_response_details')?['body/submitDate'])

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
Displaced_2000
Frequent Visitor

Many thanks, I've actually already achieved that part, sorry if my question was not entirely clear.

 

I want to use the result of that concatenation in another expression

So if the result was House5, how do I construct and use that as part of another expression like below?

outputs('Get_item_LA')?['body/House5']

 

I've done the below using compose, this generates the correct coding I need, but I can't seem to execute that to retrieve the value of body/House5?

 

Displaced_2000_0-1619775413863.pngDisplaced_2000_1-1619775442604.png

 

When I put the two versions side by side, the output of the compose and then the normal link to the house5 field

The compose returns the expression (GREEN), while the normal link returns 75020 (BLUE)

 

I want the compose to generate the expression and return me 75020 if possible?

 

Displaced_2000_2-1619775541453.pngDisplaced_2000_3-1619775585417.png

 

 

 

 

Ok Understood. Reason your compose isn't working because its not an expression. Its a plain text.

 

This is definitely not straight forward since you would like to make it dynamic. Best Option is to leverage REST APIs where you can manipulate string payload and write that in select clause.

 

There is one other option possible using Get Items. See below if it can be of help ..

 

PrasadAthalye_0-1619784854037.png

 

Below is my expression for item... 

 

item()?[ variables('DyamicColumn')]

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
Displaced_2000
Frequent Visitor

Many thanks for your support with this issue.

I tried to adopt your suggestion above using the SELECT function but I wasn't able to see how it would work in my scenario.

 

I've managed to sort my issue, albeit probably not in the most eloquent way.  I've nested if statements. It looks a mess but does what I need it to do for now.

 

Thanks again for your help.

 

 

if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House6'),outputs('Get_item_LA')?['body/House6'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House5'),outputs('Get_item_LA')?['body/House5'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House4'),outputs('Get_item_LA')?['body/House4'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House3'),outputs('Get_item_LA')?['body/House3'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House2'),outputs('Get_item_LA')?['body/House2'],if(equals(concat(outputs('Get_Property_Type')?['body/PropertyType'],outputs('Get_response_details')?['body/r16485acb4b4c437c966b09aebdc49e3f'],outputs('Get_response_details')?['body/rba5ca66e8c034ef5aa0c6c1743acc957']),'House1'),outputs('Get_item_LA')?['body/House1'],''))))))

 

  

@PrasadAthalye  I went back and revisited your suggestion using select and finally figured it out, which has given me a cleaner solution which is more understandable for other users when reviewing the flow.

 

So for anyone else with a similar issue, this is what I've ended up doing to achieve my desired outcome.

 

Displaced_2000_0-1620204375824.png

Displaced_2000_1-1620204422646.png

Displaced_2000_2-1620204458202.png

int(first(variables('Get LA Value'))?[outputs('PROPBEDS')])

 

Many Thanks

 

Great !! Happy that you managed to resolve the issue. Can you please accept the solution for this thread to close it?

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,326)