Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Patch Function for a Gallery

(0) ShareShare
ReportReport
Posted on by

Hi I have a form in my PowerApps screen and a Gallery! 

Danny_Dicaprio_0-1702393425605.png

 on the onselect of my  Add button I have added following  and my gallery items is My collection

 

Collect( MyCollection, { Skill: DataCardValue39.Text, // Assuming DataCardValue39 is a text input control ProficiencyLevel: DataCardValue36.Selected.Value, ExperienceLevel: DataCardValue38.Selected.Value } );

 

Gallery Lable controls are Label6_3 :Text Property ThisItem.Skill   same for the following

 

what Iam really looking is I want record these collection as new record in my Data Source , ( Each skill should be a new record  )

but Iam unable to do it , tried using the following patch function which is not working properly

 

Could Anyone please help me to fix it 

 

 
ForAll(

    MyCollection,

    Patch(

        'New tables',

        Defaults('New tables'),

        {

            'Emp ID': DataCardValue20_1.Text,

            'Employee Name': DataCardValue25_1.Text,

            'Official Email ID ': DataCardValue27_1.Text,

            Skills: Label6_3.Text,

            'Proficency Level': Label6_4.Text,

            'Expereince ': Label6_5.Text

        }

    )

);
  • scalca Profile Picture
    on at
    Re: Patch Function for a Gallery

    what kind of errors ? 
    what about the other 3 fields Emp ID, Employee Name, Email Id ? 
    can you specify a little bit more what your goal is ? 

  • Danny_Dicaprio Profile Picture
    on at
    Re: Patch Function for a Gallery

    so are u suggesting me to change the formula into following ?

     

    ForAll(
    MyCollection As ColRecord,
    Patch(
    'New tables',
    Defaults('New tables'),
    {
    'Emp ID': DataCardValue1.Text,
    'Employee Name': DataCardValue6.Text,
    'Official Email ID ':DataCardValue7.Text
    Skills: ColRecord.Skill,
    'Proficiency Level': ColRecord.ProficiencyLevel,
    'Expereince ':ColRecord.ExperienceLevel
    }
    )
    );
    Clear(MyCollection);

     

    this formula is also showing some error and could u help me with it ?

     

  • scalca Profile Picture
    on at
    Re: Patch Function for a Gallery

    try using As function in ForAll
    ForAll(MyCollection As ColRecord .... 
    and then when you're patching do 
    Skills: ColRecord.Skill
    Proficiency Level: ColRecord.ProficiencyLevel

    looping through the collection and using values of it
    in your code you are referencing controls instead of collection values
    hope this helps

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

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard