Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Collection gallery and add new rows and patch formula not working, help.

(0) ShareShare
ReportReport
Posted on by 1,994
hi 

I have 4 different fields as a group (AreaImprove; Expected Standard, Action and Results)  and need to be able to add 3 more new groups of the same fields 2 to 4
I try using gallery to add new row but it appears to be the same name , Area2 label should AreaImprove 2, Expected Standard 2 and so on..
 
and the add new group / delete button should appear at each group, .Not sure if this is right way to do it, or should I created 4 gallery and patch back? 
but how to collapse and expand the gallery when add new group?
 
and the patch button is also not pick the data to SharePoint list?
ForAll
(PGal.AllItems,
Patch('PIP Database',
{
AreaImprove:  "",
ExpectedStandard: "",
Action: "",
ResultsAchieve:""
}
))
 
 
Gallery to create groups of same row 
 
 
  • bbsin Profile Picture
    1,994 on at
    Collection gallery and add new rows and patch formula not working, help.
    Hi @ Chris,
     
    Not quite sure how
    is it under ONstart as the collection is created in OnStart -
    I need to update 2 gallery data collection
     
    ClearCollect(
        colPIP1,
        {
            AreaNeedingImprovement1: "",
            ExpectedStandardPerf1: "",
            ResultsAchieved1L: "",
            AgreedAction1: "",
            ID: 1
        }
    );
    ClearCollect(
        colPIP2,
        {
            AreaNeedingImprovement2: "",
            ExpectedStandardPerf2: "",
            ResultsAchieved2: "",
            AgreedAction2: "",
            ID: 1
        }
    )


    do I add OnStart?
     
    UpdateContent{??? not quite sure how
    how to reset the form and gallery to new when it's submitted too?

    like that - however, there's errors
    ​​​​​​​ONSTART
    UpdateIf(
        colPIP1, true,{
            AreaNeedingImprovement1: TextInput1.Text,
            ExpectedStandardPerf1: 'TextInput1.1'.Text,
            ResultsAchieved1L: 'TextInput1.2'.Text,
            AgreedAction1: 'TextInput1.3'.Text
           
        };
          colPIP2, true,{
            AreaNeedingImprovement1: TextInput2.Text,
            ExpectedStandardPerf1: 'TextInput2.1'.Text,
            ResultsAchieved1L: 'TextInput2.2'.Text,
            AgreedAction1: 'TextInput2.3'.Text
           
        };

        ClearCollect(
        colPIP1,
        {
            AreaNeedingImprovement1: "",
            ExpectedStandardPerf1: "",
            ResultsAchieved1L: "",
            AgreedAction1: ""
           
        }
    );
    ClearCollect(
        colPIP2,
        {
            AreaNeedingImprovement2: "",
            ExpectedStandardPerf2: "",
            ResultsAchieved2: "",
            AgreedAction2: ""
           
        }
    );
    ForAll(gal1Plan.AllItems,
    Patch('PIP Database',
        {AreaNeedingImprovement1: TextInput1.Text,
            ExpectedStandardPerf1: TextInput1.1.Text,
            ResultsAchieved1L: TextInput1.2.Text,
            AgreedAction1: TextInput1.3.Text,}));
    ForAll(gal2Plan.AllItems,
    Patch('PIP Database',
        {AreaNeedingImprovement1: TextInput2.Text,
            ExpectedStandardPerf1: TextInput2.1.Text,
            ResultsAchieved1L: TextInput2.2.Text,
            AgreedAction1: TextInput2.3.Text,}))))
     
    Thank you
     
     
     
     
  • Suggested answer
    Chris Ludwig Profile Picture
    34 on at
    Collection gallery and add new rows and patch formula not working, help.
    Hello, 
    The approach is a good one. 

    To edit the field, you can create a collection for your gallery that has the appropriate columns. To do this, create another field for the ID. You can now write this gallery in the item property of your gallery.

    If you now want to add a group, create a new entry in your gallery - you have to increase the ID by one. 

    You can now use the ID for the label, e.g. by first creating or editing a variable on the “+” button: UpdateContext{int_nextId: Value(Last([CollectionName]))}. Then create another collection entry with : Collect([CollectionName],{ID: int_nextId, ...}).

    Now you can name your label correctly, e.g. as follows: “AreaImprove” & Text(ThisItem.ID)
     

    If this answer helps you, I would be very happy if you could verify it as an answer.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard