cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Waynx
New Member

Patch Not Updating

Hi!

 

I am currently trying to work out an issue with a Patch function. I have done the Patch function multiple times before on my previous apps with no issues, but am facing issue with my current app where the patch function does not update an existing record on my sharepoint list, but rather creating a new line. 

 

My sharepoint list named "Bino Tracking" is storing data whenever a binoculars is being used, who is using it, their number and where it is right now (if it is not in used). I have tried First(Filter('Bino Tracking'.. but it doesnt work as well. Each time I patch it, it will create a new record instead of updating the existing bino based on the unique ID (UID)

 

 

 

Patch(
    'Bino Tracking',
    LookUp(
        'Bino Tracking',
        UID = Label11.Text
    );
    {
        Title: DataCardValue9.Text,
        'Current/Last User': DataCardValue14.Text,
        'Current/Last User Hp No': DataCardValue15.Text,
        'Last Checked Out Date': DataCardValue12.Text,
        'Current Location': DataCardValue10.Text,
        'Number of Times Used': DataCardValue11.Text
    }
)

 

 

 

Will greatly appreciate the help, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Waynx ,

Then just drop Value() - although it is strange why yours does not work unless the UID does not equal Lable11.Text.

With(
   {
      wID:
      LookUp(
        'Bino Tracking',
        UID = Label11.Text
      ).ID
   },
   Patch(
      'Bino Tracking',
      {ID: wID},   
      {
         Title: DataCardValue9.Text,
         'Current/Last User': DataCardValue14.Text,
         'Current/Last User Hp No': DataCardValue15.Text,
         'Last Checked Out Date': DataCardValue12.Text,
         'Current Location': DataCardValue10.Text,
         'Number of Times Used': DataCardValue11.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @Waynx ,

Is UID Numeric? If so you need to convert your Text Box output to a number. Also, try this

With(
   {
      wID:
      LookUp(
        'Bino Tracking',
        UID = Value(Label11.Text)
      ).ID
   },
   Patch(
      'Bino Tracking',
      {ID: wID},   
      {
         Title: DataCardValue9.Text,
         'Current/Last User': DataCardValue14.Text,
         'Current/Last User Hp No': DataCardValue15.Text,
         'Last Checked Out Date': DataCardValue12.Text,
         'Current Location': DataCardValue10.Text,
         'Number of Times Used': DataCardValue11.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Thanks for the swift response @WarrenBelz !

 

My UID is an alphanumeric value B120220615, B220220615, etc.. It is stored as a single line text in my sharepoint list. I tried the formula but got a warning thrown back instead for incompatible types for comparison. Does it have something to do with the UID value?

Hi @Waynx ,

Then just drop Value() - although it is strange why yours does not work unless the UID does not equal Lable11.Text.

With(
   {
      wID:
      LookUp(
        'Bino Tracking',
        UID = Label11.Text
      ).ID
   },
   Patch(
      'Bino Tracking',
      {ID: wID},   
      {
         Title: DataCardValue9.Text,
         'Current/Last User': DataCardValue14.Text,
         'Current/Last User Hp No': DataCardValue15.Text,
         'Last Checked Out Date': DataCardValue12.Text,
         'Current Location': DataCardValue10.Text,
         'Number of Times Used': DataCardValue11.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Waynx
New Member

Thanks so much this works! With is a brand new formula to me. Not really sure how it works but will read up on it. Thanks again!

Hi @Waynx ,

I am simply getting the ID (the built-in unique identifier) to match the Lookup query, which is of course is the one you want to Patch. Once you do this, Patch will always update the correct record, but as I said, your lookup should have worked.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,830)