cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
data25
New Member

converting one column table to multiple columns table

I have a table which has one column  named "id/name/age" and  some rows ,"1/xxx/23", "2/yyy/33", "3/zzz/55".... 

 

I'm trying converting this table to new table which has three columns, "id", "name", "age". I guess I should use Split(), AddColumns().

 

Do you have any idea? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @data25

 

My inclination would be to split the data at the data source level. Perhaps you use a data source that supports computed columns?

 

Failing that, here's the syntax you would use that incorporates the AddColumns and Split functions.

 

AddColumns(myDataSource,
           "ID", First(Split(IdNameAgeColumn, "/")).Result,
           "Name", Last(FirstN(Split(IdNameAgeColumn, "/").Result, 2)).Result,
           "Age", Last(FirstN(Split(IdNameAgeColumn, "/").Result, 3)).Result
)

Hope that helps.

View solution in original post

4 REPLIES 4
timl
Super User III
Super User III

Hi @data25

 

My inclination would be to split the data at the data source level. Perhaps you use a data source that supports computed columns?

 

Failing that, here's the syntax you would use that incorporates the AddColumns and Split functions.

 

AddColumns(myDataSource,
           "ID", First(Split(IdNameAgeColumn, "/")).Result,
           "Name", Last(FirstN(Split(IdNameAgeColumn, "/").Result, 2)).Result,
           "Age", Last(FirstN(Split(IdNameAgeColumn, "/").Result, 3)).Result
)

Hope that helps.

View solution in original post

Thank you very much for your answer ! It works as expected !

I always use Google Sheet as datasource, but in case this I faced 6 columns limitation, so I concatenate multiple columns in Google Sheet before powerapps, and then split 6 columns again. 

That's why I'd like to know this.

Thank you!

timl
Super User III
Super User III

Thanks for clarifying the Google Sheet data source. I'm very glad the formula works for you.

Hi,

 

I'm trying to do something very similar. I have one textinput where the user paste a data from Excel.

 

I want to save this information in a collection with multiple columns, this is my code right now

 

Collect(
TestColl;
Split(
Substitute(TextInput3.Text;Char(9);"/");
Char(10)
)
);;AddColumns(TestColl;"Fase";First(Split(Result;"/").Result).Result;"Done"; Last(FirstN(Split(Result; "/").Result; 2)).Result)

 

This is what I'm getting right now, any ideas?

 

Example1.JPG

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

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

Top Solution Authors
Top Kudoed Authors
Users online (87,298)