web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do i add more valu...
Power Apps
Answered

How do i add more values to collection in powerapps?

(0) ShareShare
ReportReport
Posted on by 107

Hello everyone,

 

I am trying to add the values from two label input into the collections but i am receiving this error

CYJ_0-1592891921816.png

 

Is it possible to do so?

Categories:
I have the same question (0)
  • Rahber Profile Picture
    1,935 on at
    The reason for that is because Split return data type Table and Label1.Text is a text data type. So the two items are of different data types

    Try this

    Collect(Test, {author: First(Split(TextInput4.Text,",")).Result},{author: Label5.Text})

    I am using the First here to get the first part of the substring. You can use Last or as per your need.
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @CYJ ,

    Could you tell me the data type of author field?

    Please notice that Split(authorinput.text,",") will return a table, while label1.Text will return a text.

    You could not update the same field with two different data structure.

    Since the record number that "Split(authorinput.text,",")" returns is dynamic, so you need to create another collection for this. Then use this collection to update author field.

    Try this formula:

    ClearCollect(test2,Split(AuthorInput.Text,","));
    //create another collection for split result
    ForAll(test2,Patch(Test,Defaults(Test),{author:Result}));
    //update multiple records in Test collection by using data in test2 collection
    Collect(Test,{author:Label1.Text})

     

    Best regards,

  • CYJ Profile Picture
    107 on at

    Hi @v-yutliu-msft ,

     

    I need them in the same collection table. 

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @CYJ ,

    I patch data all to Test collection.

    Test2 collection is just another collection that stored the temporary data.

     

     

    Best regards,

  • CYJ Profile Picture
    107 on at

    Hi @Rahber ,

     

    How do i get all of them? Using first, i would only be getting the first value in the collection (the same goes to last vice versa).

  • CYJ Profile Picture
    107 on at

    Hi @v-yutliu-msft ,

     

     

    Ok i got it what you mean and its working. But now i noticed i need to split the label1.text as well. So how do i stored them it the same table collection?

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @CYJ ,

    Same principle.

    Firstly save split result for label1 to another collection, then collect data to Text collection.

    Try this:

    ClearCollect(test2,Split(AuthorInput.Text,","));
    ForAll(test2,Patch(Test,Defaults(Test),{author:Result}));
    ClearCollect(test3,Split(Label1.Text,","));
    ForAll(test3,Patch(Test,Defaults(Test),{author:Result}));
    

     

     

    Best regards, 

  • Rahber Profile Picture
    1,935 on at

    You can use:

    Collect(CollectionName, {author: Concat(Split(AuthorInput.Text,","),Result & ";")},{author: Label6.Text});

     

    Please accept it as a solution if it resolved your problem or up vote if it helped you in anyway!

    Regards,

    Rahber

  • CYJ Profile Picture
    107 on at

    Hi @v-yutliu-msft ,

     

    Did i miss anything? I dont get why i am facing this error. Do i need to create a collection for test8?

    CYJ_0-1592907521466.png

     

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @CYJ ,

    Yes, the reason why you met this problem is that there's no Test8 already.

    You need to firstly have a collection named Test8, then use patch function to add records for collection Test8.

    For example:

    Collect(Test,{author:""});
    ClearCollect(test2,Split(AuthorInput.Text,","));
    ForAll(test2,Patch(Test,Defaults(Test),{author:Result}));
    ClearCollect(test3,Split(Label1.Text,","));
    ForAll(test3,Patch(Test,Defaults(Test),{author:Result}));

     

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard