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

Bulk insert with delimited strings

Say i have the following two comma delimited strings, each split by the split function,

I,have,a,dog

His,name,is,bucky

 

I want to insert these split strings into a datatable such that it looks like

I           His

have    name

a          is

dog     bucky

 

I've tried a forall which successfully inserts the "I have a dog" column, but puts only "His" into every field of column 2.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Bulk insert with delimited strings

@epiej 

Let's say you have two collections from your splits:

ClearCollect(col1, Split("I,have,a,dog", ","));
ClearCollect(col2, Split("His,name,is,bucky",","))

From that we will create a new collection (col3) and put them together:

Clear(ss3);
ForAll(col1, 
Collect(col3,
{column1:Result,
column2:Last(FirstN(col2,CountRows(col3)+1)).Result
}
)
)

You will now have col3 with two columns and the information distributed as you are asking.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
2 REPLIES 2
Super User
Super User

Re: Bulk insert with delimited strings

I've done something like this, but using Flow rather than PowerApps.  What you really need is a For Loop where you can reference the individual words using an Index variable.  That's possible with a DoWhile loop in Flow.  I'm not sure how you would do it in PowerApps.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: Bulk insert with delimited strings

@epiej 

Let's say you have two collections from your splits:

ClearCollect(col1, Split("I,have,a,dog", ","));
ClearCollect(col2, Split("His,name,is,bucky",","))

From that we will create a new collection (col3) and put them together:

Clear(ss3);
ForAll(col1, 
Collect(col3,
{column1:Result,
column2:Last(FirstN(col2,CountRows(col3)+1)).Result
}
)
)

You will now have col3 with two columns and the information distributed as you are asking.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 86 members 3,998 guests
Please welcome our newest community members: