cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
YDRDK
Helper I
Helper I

Error when using split

Hi,

 

I have a flow, where someone is filling out a form that is then approved. Once it is approved I need to use the information from this form to enter information into a different form. I have one field where I need to split the information in order to use it in the new form that I am entering information into.

 

I got help previously for how to make this split and it works. Now I have had to do some changes to the flow (removing an adaptive card for approval and therefore moving this part of the flow to a new flow), but now it keeps failing. When I test it out it keeps giving me this error:

 

Unable to process template language expressions in action 'Split_first_2' inputs at line '1' and column '23835': 'The template language function 'split' expects two parameters: the string to split as the first parameter, the separator as the second parameter. The function was invoked with '1' parameter(s). Please see https://aka.ms/logicexpressions#split for usage details.'.

 

Does anybody know why it does that and what I can do?

 

Thank you!

 

Best,

Majken

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @YDRDK,

 

Your expression is missing a separator in the split function. Normally this would be something like a comma, semi-colon or whatever character you want to use.

splitfunction_example.png

 

In your case the expression would be something like this. Replace the comma by something you want to use.

trim(first(split(triggerOutputs()?['body/Project_x0020_ID_x0020_Name'], ',')))

 

 

View solution in original post

7 REPLIES 7
Expiscornovus
Dual Super User
Dual Super User

Hi @YDRDK,

 

It looks like it is missing either the string or the separator, because the error says you only have 1.

 

Can you share a screenshot of your current flow setup and the split expression you are using?

Hi @Expiscornovus 

 

Yes for course.

 

Picture 1.PNGPicture 2.PNG

The expression I am using is this: 

trim(first(split(triggerOutputs()?['body/Project_x0020_ID_x0020_Name']))) - and last in the other one. The "triggerOutputs()?['body/Project_x0020_ID_x0020_Name']" is chosen from dynamic content.
 
Before I had a adaptive card in where the user should approve some things before this split was used and it worked great in that flow, however the turns out that the adaptive card is not useful in this situation anyways. 
 
I hope this can help you.

 

Expiscornovus
Dual Super User
Dual Super User

Hi @YDRDK,

 

Your expression is missing a separator in the split function. Normally this would be something like a comma, semi-colon or whatever character you want to use.

splitfunction_example.png

 

In your case the expression would be something like this. Replace the comma by something you want to use.

trim(first(split(triggerOutputs()?['body/Project_x0020_ID_x0020_Name'], ',')))

 

 

Thank you @Expiscornovus - that worked! 🙂 I must have missed that part of it and I was going crazy because I could not figure out how.

I have a similar case, where I need to do a split on a user defined input. The problem is that the user sometimes doesn't  use the delimiter. I've tried the following code but keep getting an error.  Essentially I want to split it if the delimiter is used, but no split if it is not.

if(length(split(triggerOutputs()?['body/subject']))>1,split(triggerOutputs()?['body/subject'],'_')[0],triggerOutputs()?['body/subject'])

Any ideas how to clear it? Thanks!

VictorIvanidze
Community Champion
Community Champion

Hi @MTEChris,

try this:

if(contains(triggerOutputs()?['body/subject'],'_'),split(triggerOutputs()?['body/subject'],'_')[0],triggerOutputs()?['body/subject']) 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

That worked! Thanks @VictorIvanidze for the help!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,619)