Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Delegable patch CDS

Hi. I have a problem with Patch function. I want to populate a field (CheckoutTime) with Now() function in an already existing record. In order to do it, I search the record by three fields values:

  • a Barcode taken from an inputText,
  • a Creation date of today (no matter what time), 
  • a CheckoutTime that is blank

In other words I want to update the record that has the specific Barcode inserted in an InputText, that has been created today and that has nothing in the field CheckoutTime.

I have written a formula but sometimes it works and sometimes not, because has non delegable function in it:

Patch(checkin_1;LookUp(Filter(checkin_1;IsBlank(DataOraCheckout);Left(Text('Data creazione');10)=Text(Today());Barcode=TextInput1.Text );Barcode=TextInput1.Text); {DataOraCheckout: Now()})

Left is not delegable, also in and Last...

So what I ask is: are there delegable functions that I can use in order to find a record by the value of this three fields? Have you ever been in this situation?

Community Support Team
Community Support Team

Re: Delegable patch CDS

Hi @Mh2 


What is your mean sometimes it works well, sometimes not.

It it not works, is there some warning message or error message and what is the message?

And more information:




Best Regards.


Level: Powered On

Re: Delegable patch CDS

I will explain it with an example. Let's take the new formula I have written: 

Patch(checkin_1; LookUp(Filter(checkin_1; IsBlank(DataOraCheckout));Barcode=BarcodeScanner4.Value); {DataOraCheckout: Now()})


I have two record on the CDS (one for user) who have the same Barcode value field, but the first one has a blank DataOraCheckout, the second has something in it because user 1 has already scan the barcode. When user 2 scans the barcode, I want to fill DataOraCheckout with his Now() time, but with the formula above, it always update the user 1 record and I cannot understand why. So I think there's something wrong with it.



Super User
Super User

Re: Delegable patch CDS

Hi @Mh2 

I think your formula has an incorrect syntax in the second element of the Patch() function.

Patch(checkin_1; LookUp(Filter(checkin_1; IsBlank(DataOraCheckout));Barcode=BarcodeScanner4.Value)
{DataOraCheckout: Now()})

I believe that you are trying to Patch an existing record in checkin_1 where DataOraCheckout is blank and the Barcode has the correct value.  The Lookup(Filter( is not the correct way to find that record. You should use either First(Filter( or Lookup() but not both.  Either of these functions will find the first record that has a blank DataOraCheckout field.  You will need an AND (&&) operator to find the record where DataOraCheckout is blank and the barcodes match. 

Patch(checkin_1;Lookup(checkin_1; IsBlank(DataOraCheckout)) && Barcode=BarcodeScanner4.Value);{DataOraCheckout: Now()})

I believe all of the functions are delegatable. 

Level: Powered On

Re: Delegable patch CDS

Ok, I have changed my function but my problem still persists...

Patch(checkin_1;LookUp(SortByColumns(checkin_1;"cr392_dataoracheckout";Descending;"createdon";Descending);And(IsBlank(DataOraCheckout);Barcode=TextInput1.Text));{DataOraCheckout: Now()})

But after some tests I've made I think the app in the moment of patching has got the checkin_1 list not updated yet. I try to explain with one example. If I have recently added a new record with the same barcode of one old, it updates the old one, even if it has something in the field DataOraCheckout. In my opinion it can see the new inserted record, so the table it has is not updated. I tried to do a Refresh(checkin_1) before the operation of patching but the problem is still there. Is there another way or function to keep the table updated for the app? Do you think is it possible such a behaviour?

Level: Powered On

Re: Delegable patch CDS

Can someone help me, please?

Level: Powered On

Re: Delegable patch CDS

As you're hinting in your last post, you need to verify first that there is a matching record prior to doing the Patch command. For example, populate a Collection first, and check "how it looks".

I have a similar case as yours (not ready-developed yet). But the tricky thing is (I find) is to "check exactly prior to sending the command". My point: My table can be populated from several applications. So theoretically there can endup a missmatch even if I check how the datasource looks via a Collection "just before" sending the Patch command.

Anyone having some idea on how to achieve this best?

Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Join PowerApps User Group!!

Connect, share, and learn with your peers year-round


Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 160 members 4,458 guests
Please welcome our newest community members: