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 / Patching from a galler...
Power Apps
Answered

Patching from a gallery and creating new items

(0) ShareShare
ReportReport
Posted on by 8

Tried to figure this out all day yesterday.  Have consulted https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-gallery-item-in-SP-list/td-p/1758662 regarding the proper syntax from patching records to a gallery:

 

Right now, I have the following gallery:

 

aborodin_1-1685595150570.png

The gallery items are from the "members" table.  The "txt_calendarday_id" control pulls from a field in this table, and the "drp_calendarday_activity" and "txt_calendarday_location" are meant to be input controls only.

 

I'd like to patch to a third table, "memberlocations." that has four columns:

 

DateRecord:

MemberID

Location

Activity

 

I believe my syntax is wrong.  I've written my patch function like this:

 

 

 

Patch(
ForAll(gal_calendarday_form.AllItems,
{
MemberID:txt_calendarday_formID.Text,
DateRecord:gblSelectedDay,
MemberLocation:txt_calendarday_formlocation.Text,
Activity:drp_calendarday_activity.Selected
}
)
)

 

 

 

It is giving me an error of: Patch expected a record but is getting a table from my ForAll.  Am I misunderstanding how this works?

 

Thanks for your help!

Categories:
  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @aborodin ,

     

    Try below:

    ClearCollect(gallery_items,gal_calendarday_form.AllItems);
    Patch(
    gallery_items,
    Defaults(gallery_items),
    {
    MemberID:txt_calendarday_formID.Text,
    DateRecord:gblSelectedDay,
    MemberLocation:txt_calendarday_formlocation.Text,
    Activity:drp_calendarday_activity.Selected.Value
    }
    )

     

    Patch cannot directly operate on the gallery.allitems, instead, it needs a collection or a table datasource.

     

    BR,

    Hen Wang

  • Verified answer
    HenWang Profile Picture
    Microsoft Employee on at

    Hi @aborodin ,

     

    Just be the way, it seems that you are trying to collect all the items inside this gallery to a new table, if yes, then you can try below formula:

    Collect(third_table,
    ForAll(Gallery1.AllItems,
    {
    MemberID:txt_calendarday_formID.Text,
    DateRecord:gblSelectedDay,
    MemberLocation:txt_calendarday_formlocation.Text,
    Activity:drp_calendarday_activity.Selected.Value
    }
    )
    )

     

    BR,

    Hen Wang

  • aborodin Profile Picture
    8 on at

    Hen,

     

    Thanks so much!  This worked!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard