Skip to main content
Community site session details

Community site session details

Session Id : bGpOH4nQcKI2U7ZkNnnMxZ
Power Apps - Building Power Apps
Unanswered

Gallery Patch to Collection Causing Invalid Arguments

Like (0) ShareShare
ReportReport
Posted on 19 May 2023 14:08:08 by 134

Hi there! I created a collection based off of a sharepoint list with the simple ClearCollect(FM_NewLog,'Food Mentoring (FM)') in a button. My gallery is coded as such:

OnSelect:

Patch(FM_NewLog,{FacilityLocation:FMFacility.Text,Month:FMMonth.Text,Year:Value(FMYear.Text),Mentees:FMMentee.SelectedItems,Mentor:FMMentor.Selected,Duties:FMDuties.Text,MentoringDate:FMDate.SelectedDate})

and the items inside are all OnChange:Select(Parent)

The gallery includes 2 lookup combo boxes and several other fields which THOUGHT I had coded correctly, but the collection looks like the attached photo and the gallery OnSelect is saying that it is expecting table instead of record.

 

As reference, I am trying to build a gallery that allows users to add data to the Microsoft list, but not view any of it, and I'm worried that not connecting the ThisItem property is messing it all up?

  • BHaapi Profile Picture
    134 on 24 May 2023 at 12:15:00
    Re: Gallery Patch to Collection Causing Invalid Arguments

    Hi there! Yes this is in a gallery. the labels are built without spaces then putting spaces in the titles (i provided a copy of what the list is compromised of)

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 19 May 2023 at 19:59:52
    Re: Gallery Patch to Collection Causing Invalid Arguments

    Hi @BHaapi ,

     

    Can you share a bit more on the context? Are these controls (FMFacility etc.) inside a gallery?

  • BHaapi Profile Picture
    134 on 19 May 2023 at 19:19:24
    Re: Gallery Patch to Collection Causing Invalid Arguments

    gosh look, i just dont know what is going on, the gallery is shooting blanks to the collection, no headers even. and the list is getting the same blanks haha i still cant format the gallery so im guessing theres still something going on.

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 19 May 2023 at 19:05:53
    Re: Gallery Patch to Collection Causing Invalid Arguments

    Hi @BHaapi ,

     

    Then try this:

    Patch(
    	FM_NewLog,
     Defaults(FM_NewLog),
    	{
    		FacilityLocation:FMFacility.Text,
    		Month:FMMonth.Text,
    		Year:Value(FMYear.Text),
    		Mentees:FMMentee.SelectedItems,
    		Mentor:FMMentor.Selected,
    		Duties:FMDuties.Text,
    		MentoringDate:FMDate.SelectedDate
    	}
    )

     

     

  • BHaapi Profile Picture
    134 on 19 May 2023 at 18:52:31
    Re: Gallery Patch to Collection Causing Invalid Arguments

    i checked it and it was set to one, plus i updated the patch again and it didnt work. i reloaded the data alltogether just to make sure. im still not able to format the patch with .selected or .selecteditems. here is the list, its also just pushing blanks to there, the one filled out was not done on the app.

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 19 May 2023 at 18:36:43
    Re: Gallery Patch to Collection Causing Invalid Arguments

    Hi @BHaapi ,

     

    Understood. However, the error text shows that FMMentor should be returning a table, meaning the Mentor column expects a table. That's why I asked. Did you check in the list if the column has been configured correctly?

  • BHaapi Profile Picture
    134 on 19 May 2023 at 18:33:11
    Re: Gallery Patch to Collection Causing Invalid Arguments

    No the mentor is just one person. they are office365 lookups. the mentee has many available, the mentor is only one.

  • BCBuizer Profile Picture
    22,262 Super User 2025 Season 2 on 19 May 2023 at 16:16:01
    Re: Gallery Patch to Collection Causing Invalid Arguments

    Hi @BHaapi ,

     

    Does the Mentor column have multiselect enabled? If yes, SelectedItems should be referenced instead of Selected to return a table:

     

    Patch(
    	FM_NewLog,
    	{
    		FacilityLocation:FMFacility.Text,
    		Month:FMMonth.Text,
    		Year:Value(FMYear.Text),
    		Mentees:FMMentee.SelectedItems,
    		Mentor:FMMentor.SelectedItems,
    		Duties:FMDuties.Text,
    		MentoringDate:FMDate.SelectedDate
    	}
    )

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started