Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Changing a value for all items in a gallery

(0) ShareShare
ReportReport
Posted on by 345

Hi all,

 

 

Capture

So I'm building an app where a user might enter in multiple staff for a unit. I have it so that, once submitted, they can edit the entry in-line. The OnChange properties of the gallery controls are set to patch on changing so that someone doesn't have to start all over again. 

 

However, I want it so that if someone change either the Unit Credits of # Students in one row, it changes for all of them. I can't seem to make that work. 

The other option is to set both of them from the entry box above, and if someone needs to change it, it cascades down into the submitted entries for that unit. However, I can't seem to make that work either. I've tried using ForAll to loop through the gallery (which is pre filtered based on what is in the Unit Name box)  when the #Student value is changed at the top, and for each entry in the gallery alter the #Students value. 

 

ForAll(
 'TA Unit Gallery_1'.AllItems,
 Patch(
 'Unit List',
 LookUp(
 'Unit List',
 ID = Value('TA Gal ID_1'.Text)
 ),
 {'Number of Students': 'TA - Value - # Students_1'}
 )
)

 

Any ideas?

Categories:
  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on at
    Re: Changing a value for all items in a gallery

    Hey @EpicTriffid 

     

    Can you try to use the formula on the top Text Inputs for Students and Unit Credits as:
     
    Students:
    ForAll('TA Unit Gallery_1'.AllItems,
        Patch(
            'Unit List',
            LookUp(
                'Unit List',
                ID = Value('TA Gal ID_1'.Text)
            ),
            {'Number of Students': Value(TextInput1.Text)}  
        )
    )
    Here TextInput1 is the name of textinput for students.
     
    Unit Credits:
    ForAll('TA Unit Gallery_1'.AllItems,
        Patch(
            'Unit List',
            LookUp(
                'Unit List',
                ID = Value('TA Gal ID_1'.Text)
            ),
            {UnitCredits: TextInput1_1.Text}
        )
    )
    Here TextInput1 is the name of textinput for UnitCredits.

    If you want to make the change if any item is updated in the gallery too, then use:
     
    Students: 
    Set(NewNumberofStudents,TextInput1_2.Text);
    ForAll('TA Unit Gallery_1'.AllItems,
        Patch(
            'Unit List',
            LookUp(
                'Unit List',
                ID = Value('TA Gal ID_1'.Text)
            ),
            {'Number of Students': Value(NewNumberofStudents)} 
        )
    )
     
    Unit Credits:
    Set(NewUnitCredits,TextInput1_3.Text);
    ForAll('TA Unit Gallery_1'.AllItems,
        Patch(
            'Unit List',
            LookUp(
                'Unit List',
                ID = Value('TA Gal ID_1'.Text)
            ),
            {UnitCredits: NewUnitCredits}
        )
    )
     
    If this differs, please share a more explanatory description of the scenario that you are trying to achieve.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • EpicTriffid Profile Picture
    345 on at
    Re: Changing a value for all items in a gallery

    Bumping this!

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,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard