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 a collection ...
Power Apps
Unanswered

Patching a collection to a dataverse table in one go works except for lookup fields

(0) ShareShare
ReportReport
Posted on by 704

I was watching the latest YT video by Shane Young where was demontsrated that you can (undocumented) patch a whole collection in one go to a table. I started experimenting and found it works if I use the "non display" names of the fields. If anything in field names or datatype my code does not correspond with the actual table I get an error (curly brackets) in the patch function.

Alas I also found that I am not able to provide the right data to put into a lookup field. F.e. my table dierevent has a lookup field protocol ("cra27_protocol" as its non display name is) referring to the dataverse table protocol. So if I have a variable named ProtocolToRun (record of the table protocol) and want to include it in the patch I would expect to provide the field/column cra27_protocol and assign a reference to this record to this to make it work. But even if I assign Blank() to cra27_protocol I get the curly brackets signifying I have broken the magic patch collection spell. No way around this I suppose?

 

 Collect(
 ParameterProtocolLines
 ;ShowColumns(
 AddColumns(
 RenameColumns(
 Filter(
 CurrentProtocolLines
 ;LineRegelType=[@ProtocolRegelTypen].'446690000' And !IsBlank(lPreInput) And (Trim(lPreInput) <> "-")
 )
 //;"Protocol";"_Protocol"
 ;"IsParameter";"_IsParameter"
 )

 ;"cra27_diereventid";ThisRecord.EventLine.cra27_diereventid//If(IsBlank(ThisRecord.EventLine);Blank();ThisRecord.EventLine.DierEvent)
 ;"cra27_eventdatum";If(IsNew;Now();EventLine.cra27_eventdatum)
 ;"cra27_memo";lPreInput
 ;"cra27_primaryname";If(Len(ItemNaam)=0;"ItemNaam";ItemNaam)
 ;"cra27_docadierid";vCurrentAnimal
 ;"cra27_eventtypeid";4
 ;"cra27_guid";LineGuid
 ;"cra27_useremail"; If(IsNew Or Trim(lPreInput)<>Trim(EventLine.cra27_memo);User().Email;EventLine.cra27_useremail)
 ;"cra27_planstatus";-1
 ;"cra27_locatieid";If(!IsBlank(gKennel_asiel);gKennel_asiel.kennel_asiel_id;0)
 ;"cra27_locatieasstring";If(!IsBlank(gKennel_asiel);gKennel_asiel.naam;"")
 ;"cra27_aantal";If(IsNumeric(lPreInput);Value(lPreInput);0)
 ;"cra27_eenheid";ParameterEenheid
 ;"cra27_parameter";recParameter//.cra27_parametersid
 ;"cra27_protocol";ProtocolToRun//.cra27_protocolid
 ;"cra27_groepid";lGroepId
 ;"cr856_verberg";VerbergEvent//'Verberg (DierEvent)'.Ja//If(VerbergEvent;'Verberg (DierEvent)'.Ja;'Verberg (DierEvent)'.Nee)
 ) 
 ;"cra27_diereventid"
 ;"cra27_eventdatum"
 ;"cra27_memo"
 ;"cra27_primaryname"
 ;"cra27_docadierid"
 ;"cra27_eventtypeid"
 ;"cra27_guid"
 ;"cra27_useremail"
 ;"cra27_planstatus"
 ;"cra27_locatieid"
 ;"cra27_locatieasstring"
 ;"cra27_aantal"
 ;"cra27_eenheid"
 //;"cra27_parameter"
 //;"cra27_protocol"
 ;"cra27_groepid"
 ;"cr856_verberg"
 ) 
 )

;;Patch(
 [@DierEvent]
 ;ParameterProtocolLines
 )

 

I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 604

#3
11manish Profile Picture

11manish 518

Last 30 days Overall leaderboard