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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection gallery and...
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 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Chris Ludwig Profile Picture
    34 on at
    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.
  • bbsin Profile Picture
    1,994 on at
    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
     
     
     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard