cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoshKane
Regular Visitor

Nesting expression help

Hey Everyone,

 

is it possible to nest string expressions?

 

I have one which I just seem to not be able to validate, They both work on there own, but when I try to nest them I can't get it to work.

 

Data: ["Alternative","Hip Hop","Rock"]

 

Expression 1: indexOf(outputs('Get_response_details')?['body/rf9d051bd49dd444fb731f2a2e4db56bc'],'Hip Hop')

(Looking to find the starting Index of the key word)

substring(outputs('Get_response_details')?['body/rf9d051bd49dd444fb731f2a2e4db56bc'],16,7)

(Get the word Hip Hop)

 

Nested expression that I want to create:

 

 substring(outputs('Get_response_details')?['body/rf9d051bd49dd444fb731f2a2e4db56bc'],(indexOf(outputs('Get_response_details')?['body/rf9d051bd49dd444fb731f2a2e4db56bc'],'Hip Hop')),7)

 

 

I have many variables that I need to extract and present as clean text so ideally having a single function to perform both tasks would be great but not sure if its possible or just a syntax error,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rhiassuring
Super User
Super User

Ah okay, I'm glad I asked -- let's do this instead: 

Step 1) Compose action, cram this in there - the part I've made bold-orange is the only part you need to modify, which is just the Dynamic Content for your Genre Question from the form.

split(replace(replace(replace(outputs('Get_response_details')?['body/r16790727ecf94cbdba47445c855e53a3'],'","','|'), '["',''), '"]',''),'|')
 
Step 2) Use the Select action to set-up the format properly - point the "From" at the Outputs from your previous compose, and in the Map, just type in "Value" for the key, and use the expression item() for the value.
 
Rhiassuring_1-1653863843378.png

 

 
Step 3) Use the output from your Select action to update your SharePoint item - make sure the icon next to the field looks like this, instead of the one that has a little T in it.
 
Rhiassuring_0-1653863629447.png
 
Success, and far less painful 🙂 
 
Rhiassuring_2-1653863943020.png

I admire your moxy though. And, moreso, what you're doing for the kids. Please let me know if you need any other help, I'd be stoked to continue aiding in that kind of non-profit work. 

Cheers,

Rhia

 

 
 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



View solution in original post

8 REPLIES 8
Rhiassuring
Super User
Super User

Hi there, 

 

I think it's possible, but I might also be missing the point of this. 

 

If you know the word you're looking for, and there's a match, why are you trying to extract it? You already know the word is hip hop, because you found the index of it, so I don't know why the second step is needed.

 

(I also know this really has nothing to do with your question, but I'm super curious on the need in this case.) 

R

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



JoshKane
Regular Visitor

Hey @Rhiassuring!

 

Big picture I have a public facing MSform which I I need to end up in a Microsoft list.

(I work for a youth music NFP and we are creating a simple database of young artists to help them get gigs)

 

Screen Shot 2022-05-30 at 7.37.30 am.pngScreen Shot 2022-05-30 at 7.38.36 am.png 

 

The issue I'm having is the check boxes from the form come in as a comma separated list e.g ["Alternative","Hip Hop","Rock"] and I need them as individual values to create the sharpoint item.

 

Screen Shot 2022-05-30 at 7.40.46 am.png

 

My solution has been to create a variable per check box and then use a search and extract to get the correct string without any additional characters, so for example this is the variable for the gene Hip Hop.

 

Screen Shot 2022-05-30 at 7.43.32 am.pngScreen Shot 2022-05-30 at 7.45.37 am.png

 

My original question was hoping to reduce the amount of components by combining the Find text position with the substring action to reduce the amount of components. The way I have it working is very long with 5 actions per variable.

 

Rhiassuring
Super User
Super User

Ah okay, I'm glad I asked -- let's do this instead: 

Step 1) Compose action, cram this in there - the part I've made bold-orange is the only part you need to modify, which is just the Dynamic Content for your Genre Question from the form.

split(replace(replace(replace(outputs('Get_response_details')?['body/r16790727ecf94cbdba47445c855e53a3'],'","','|'), '["',''), '"]',''),'|')
 
Step 2) Use the Select action to set-up the format properly - point the "From" at the Outputs from your previous compose, and in the Map, just type in "Value" for the key, and use the expression item() for the value.
 
Rhiassuring_1-1653863843378.png

 

 
Step 3) Use the output from your Select action to update your SharePoint item - make sure the icon next to the field looks like this, instead of the one that has a little T in it.
 
Rhiassuring_0-1653863629447.png
 
Success, and far less painful 🙂 
 
Rhiassuring_2-1653863943020.png

I admire your moxy though. And, moreso, what you're doing for the kids. Please let me know if you need any other help, I'd be stoked to continue aiding in that kind of non-profit work. 

Cheers,

Rhia

 

 
 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



JoshKane
Regular Visitor

Rhia! You truly are the Resident Rockstar! 🎸

 

That is going to be sooo much cleaner and easier than the dumpster fire I made in lieu of your great advice!

 

thanks so much!

 

Screen Shot 2022-05-30 at 8.52.05 am.pngScreen Shot 2022-05-30 at 8.52.19 am.pngScreen Shot 2022-05-30 at 8.52.28 am.png

Rhiassuring
Super User
Super User

kermit-frog.gif

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



JoshKane
Regular Visitor

Hey @Rhiassuring one little follow up question .

 

When the select function is provided a single result, it complains about the lack of array?

 

Any pointers?/ideas

Screen Shot 2022-05-31 at 8.55.17 am.png

Rhiassuring
Super User
Super User

Hmm.. I just tested with a single value, and I don't get that error. My flow looks like this: 

Rhiassuring_0-1654010073481.png
Does yours differ anywhere? Let's track down the issue..

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Fun fact - I'm a dumb dumb and didn't follow you instructions as closely as I should.

 

EVERYTHING IS WORKING GREAT! Thanks Again,

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,021)