POWER APP Patch 函数的三种用法

UPDATE(常用) , insert (CREATE 数据, 建议用collect ),合并数据不常用

Use the Patch function to modify one or more records of a data source. The values of specific fields are modified without affecting other properties. For example, this formula changes the phone number for a customer named Contoso:

Patch( Customers, First( Filter( Customers, Name = "Contoso" ) ), { Phone: "1-212-555-1234" } ) update 数据

Use Patch with the Defaults function to create records. Use this behavior to build a single screen for both creating and editing records. For example, this formula creates a record for a customer named Contoso: insert数据 ,但是不如collect 方便

Patch( Customers, Defaults( Customers ), { Name: "Contoso" } )

Even if you’re not working with a data source, you can use Patch to merge two or more records. For example, this formula merges two records into one that identifies both the phone number and the location for Contoso: 合并数据, 不常用!

Patch( { Name: "Contoso", Phone: "1-212-555-1234" }, { Name: "Contoso", Location: "Midtown" } )

Leave a Reply

Your email address will not be published. Required fields are marked *