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 / Nesting expression help
Power Automate
Unanswered

Nesting expression help

(0) ShareShare
ReportReport
Posted on by 17

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,

 

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    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

  • JoshKane Profile Picture
    17 on at

    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.

     

  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at

    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

     

     
     
  • JoshKane Profile Picture
    17 on at

    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 Profile Picture
    8,690 Moderator on at

    kermit-frog.gif

  • JoshKane Profile Picture
    17 on at

    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 Profile Picture
    8,690 Moderator on at

    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..

     

  • JoshKane Profile Picture
    17 on at

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

     

    EVERYTHING IS WORKING GREAT! Thanks Again,

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard