cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pcakhilnadh
Helper IV
Helper IV

How to split values and append it to an existing collection?

  1. I've 1 item in a collection named "myCol"

 

ClearCollect(myCol,{Item:Inp1.Text})​

 

  • I've a string " item4, item7,item8"
  • I wanted to split the string by "," and append values to "myCol" under column name"Item"

How to split values and append it to an existing collection?

1 ACCEPTED SOLUTION

Accepted Solutions
pcakhilnadh
Helper IV
Helper IV

ForAll(Split(Inp2.Text,","),If(!IsBlank(Last(Split(Result,",")).Result),Collect(myCol,{Item:Last(Split(Result,",")).Result})))

View solution in original post

3 REPLIES 3
poweractivate
Super User
Super User

@pcakhilnadh 

 

Can try this

 

Collect(MyCollection,Split(Label2.Text,","))

 

Replace Label2.Text with whatever has your  " item4, item7,item8" string in there.

 

poweractivate_0-1634743447123.png

poweractivate_1-1634743457679.png

 

@poweractivate 
Initially I've a collection. I wanted to append to it. As you have shown after Split() the values stored under column "Result" where as my initial collection I wanted to store under"Item"

pcakhilnadh
Helper IV
Helper IV

ForAll(Split(Inp2.Text,","),If(!IsBlank(Last(Split(Result,",")).Result),Collect(myCol,{Item:Last(Split(Result,",")).Result})))

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,596)