cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
empecollins
Level: Powered On

How can I convert a string to an array and then use the first item in the array

I am trying to figure out how to take a SharePoint list item field which as a string that has a ; separated list.  This is going to be a list of emails that need to be notified for approval.  The list is dynamic and changes with each list item that needs to be approved so we are putting the list of emails in a field for each item.  I want to be able to split the strings into an array, grab the first item use it and then remove it from the current list.

Here is the logic that I would like to try:

 

@take(split('persona;personb;personc',';'),1)

@skip(split('persona;personb;personc',';'),1)

 

 

However, when I initialize my variable in my flow, it doesn't execute any functions.  How can I get the functions to process and not act like strings?

 

Here is a screen shot of my initialize variable:

 

InitVariable.JPGInitializing Variable Step

debug.JPGDebug Results of run

So basically after the flow run, it just places the formula into the variable and doesn't actually process the formula.  Sorry for the basic question, but I have not been able to figure out how to get a formula to work in flow.

3 REPLIES 3
Community Support Team
Community Support Team

Re: How can I convert a string to an array and then use the first item in the array

Hi @empecollins,

 

I'm investigating on this and will update if I have further information.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
nsgma
Level: Powered On

Re: How can I convert a string to an array and then use the first item in the array

Hello @empecollins

Maybe I am stating the obvious (I am quite new at this) but you need to enter the expression in the "add dynamic content >> Expression" without the @ sign. I think I was able to enter some expressions with the @ but I cannot replicate that for the last few days.

Also you may want to add a join expression to convert it to a string.

join(take(split('persona;personb;personc',';'),1),'')

Anyway thanks, your post helped me making some sense on how to deal with arrays. There is very little documention on the expressions and syntax.

Super User
Super User

Re: How can I convert a string to an array and then use the first item in the array

@v-monli-msft: Are there any news on this?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (2,601)