cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

I have found several posts, blogs, and videos that show me how to separate data when there is only one row of data, but I have multiple rows of data that I need to separate. My app populates a plain text multi-line text column in a SharePoint list with the data that was inputted in a repeating table:

Master List item ID; Repeating Table ID; User Name; User Email; User License Type

Because it's a repeating table, there will be more than one entry. My data comes over looking like this:

368;1;Bob Smith;Bob.Smith@test.com;Team;|368;2;Sue Jones;Sue.Jones@test.com;Expert;|

I was able to successfully build a flow that would take one row of data (368;1;Bob Smith;Bob.Smith@test.com;Team;) and populate my columns, but I can't seem to figure out the array and expression for multiple rows. I get the following error:

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2837': 'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#split for usage details.'

The flow needs to loop at the "|", create a new row in my list, and populate the columns. I feel like I'm close, but I'm obviously missing something. I found a couple of blogs that confuse me. I've tried some different expressions in my first Compose action, but neither work:

split(first(split(triggerBody()?['{UserInfo}'],'|')),';')
split(first(split(items('Apply_to_each')?['UserInfo'],'|')),';')

My flow looks like this:

 

1.

1.PNG

 

2.

2.PNG

 

3.

3.PNG

 

4.

4.PNG

And I have a warning from my flow that this setup could result in an infinite loop, so I need to figure out how to fix that.

Any help on splitting my variable and creating new rows without creating an infinite loop would be huge.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Hi @ACPBSCi ,

Could you please share more details about the "Run History" about the "Filter array" action in your flow?

Could you please share a screenshot about the flow's configuration your side?

 

According to the issue that you mentioned, it seems to tell that the split(item(), ';') expression within the "Compose" action could not return a proper table value in your flow. As expected behavior, it should split the following string value:

368;1;Bob Smith;Bob.Smith@test.com;Team;

into a table value against the ';' operator. So the  split(item(), ';') expression result should be a Table value consists of 6 elements (including a blank value). So please check the "Filter array" action in your flow has returned proper table value in your flow Run History:

1.JPG

If the returned result in your "Filter array" action is not like above screenshot, I think there is something wrong with your "Filter array" action.

2.JPG

 

I have attached my sample flow's configuration for your, please check if it could help in your scenario.

 

Please go to check your Flow Run History, then check if each step returns a desired result as expsted.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

@ACPBSCi 

This sounds like a Power Automate question rather than a PowerApps question.  I suggest you post this in the Power Automate Community instead. You’ll get a quicker and better response over there

Link to Power Automate Community
https://powerusers.microsoft.com/t5/Get-Help-with-Power-Automate/ct-p/FL_GeneralDiscussions


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Community Support
Community Support

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Hi @ACPBSCi ,

Does the "Users" dynamic content in your "UserInfo Variable" action store the repeating table data like "368;1;Bob Smith;Bob.Smith@test.com;Team;|368;2;Sue Jones;Sue.Jones@test.com;Expert;|"?

Do you want to patch the repeating table data back to your SP List corresponding columns?

 

Based on the needs that you mentioned, I think there is something wrong with the "UserArray variable" action in your flow. You should use '|' as separator rather than ';'. I have made a test on my side, please consider try the following workaround:

4.JPG

 

5.JPG

 

7.JPG

Within the "UserArray variable" action, set the Value field to following:

split(variables('UserInfo'), '|')

Within the "Filter array" action, From field set to UserArray variable, left condition field set to following:

empty(item())

right condition field set to following expression:

true

middle operator box set to "is not equal to".

 

Within the "Apply to each" action, set the Inputs field in "Master List Item ID" action to following:

split(item(), ';')[0]

Inputs field in "Repeating Table ID" action to following:

split(item(), ';')[1]

Inputs field in "User Name" action to following:

split(item(), ';')[2]

Inputs field in "User Email" action to following:

split(item(), ';')[3]

Inputs field in "User License Type" action to following:

split(item(), ';')[4]

then within the "Create item" action, you could reference Outputs dynamic content from above corresponding "Compose" actions.

 

Please take a try with above solution, hope it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Thank you, @mdevaney. I'll post it there, too.

Highlighted
Helper II
Helper II

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Thank you, @v-xida-msft. I'm giving it a try now. FYI, I also posted in the Power Automate community. I spent so much time on my app that I gravitated back to this community out of habit. Whoops!

I've implemented the changes and still get the infinite loop warning. Any thoughts about that? In order to prevent a loop in a different workflow, I had to add a flag. That can get complicated with an index and telling the flow to set the flag and then check to see if the flag is set in order to not enter the loop. Is there a better way?

Highlighted
Helper II
Helper II

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

@v-xida-msft, to answer your questions:

Does the "Users" dynamic content in your "UserInfo Variable" action store the repeating table data like "368;1;Bob Smith;Bob.Smith@test.com;Team;|368;2;Sue Jones;Sue.Jones@test.com;Expert;|"? Yes

Do you want to patch the repeating table data back to your SP List corresponding columns? Yes

The first variable for Master List ID worked, but it errored at the second:

InvalidTemplate. Unable to process template language expressions in action 'UserID' inputs at line '1' and column '2837': 'The template language expression 'split(item(), ';')[1]' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

I'll dig in and try some things. Do you have any thoughts?

Highlighted
Community Support
Community Support

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Hi @ACPBSCi ,

Could you please share more details about the "Run History" about the "Filter array" action in your flow?

Could you please share a screenshot about the flow's configuration your side?

 

According to the issue that you mentioned, it seems to tell that the split(item(), ';') expression within the "Compose" action could not return a proper table value in your flow. As expected behavior, it should split the following string value:

368;1;Bob Smith;Bob.Smith@test.com;Team;

into a table value against the ';' operator. So the  split(item(), ';') expression result should be a Table value consists of 6 elements (including a blank value). So please check the "Filter array" action in your flow has returned proper table value in your flow Run History:

1.JPG

If the returned result in your "Filter array" action is not like above screenshot, I think there is something wrong with your "Filter array" action.

2.JPG

 

I have attached my sample flow's configuration for your, please check if it could help in your scenario.

 

Please go to check your Flow Run History, then check if each step returns a desired result as expsted.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper II
Helper II

Re: Splitting a Variable with Multiple Rows of Data and Populating SharePoint List Columns

Thank you, @v-xida-msft! That worked! FYI, I added a flag to my list, a Y/N column to indicate that the flow ran, then I added a condition before the Apply to Each. That prevents the loop.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,456)