cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Farzad
Frequent Visitor

completing dataset without adding new record

I would appreciate it if you help me.
I have a dataset with many columns including a barcode id (a code) on SharePoint, and 3 more columns are empty that need to be filled through Powerapps. I want to scan materials via PowerApps and complete the dataset on SharePoint based on the barcode.
It needs to match the barcode (SharePoint and PowerApps) and then submitform or record 3 variables.  I do not want to have new rows.

 

the below code does not work.

 

 

Set(varScan; LookUp(Material_Inventory1; HRSG1=Label1.Text);
Patch(Material_Inventory1; Defaults(Material_Inventory1); { Status:Status_DataCard1; QTY: QTY_DataCard1; Location:Location_DataCard1 })

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Farzad ,

I assume here varScan is the relevant record to be updated

With(
   {
      wScanID; 
      LookUp(
         Material_Inventory1; 
         HRSG1=Label1.Text
      ).ID
   };
   Patch(
      Material_Inventory1; 
      {ID: wScanID};
      { 
         Status: Status_DataCard1.Text; 
         QTY: QTY_DataCard1.Text; 
         Location: Location_DataCard1.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

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @Farzad ,

I assume here varScan is the relevant record to be updated

With(
   {
      wScanID; 
      LookUp(
         Material_Inventory1; 
         HRSG1=Label1.Text
      ).ID
   };
   Patch(
      Material_Inventory1; 
      {ID: wScanID};
      { 
         Status: Status_DataCard1.Text; 
         QTY: QTY_DataCard1.Text; 
         Location: Location_DataCard1.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

It does not work.

The SharePoint table is like below where HRSG1=barcode. 
I Have a form in PowerApps Including HRSG1(scan code), Status, QTY and Location.

 

Farzad_0-1668586063917.png

 

 

Farzad
Frequent Visitor

Finally, it works. After removing the Form and making separate text and Items. 
and I modified your code a little bit.
Thanks a lot.

 

 

With(
      {wScanID: 
      LookUp(
         Material_Inventory1; 
         HRSG1=Label1.Text
      ).ID};
      Patch(
         Material_Inventory1; 
         {ID: wScanID};
         { 
            QTY:Value(TextInput1.Text);
         Status: {Value:Dropdown2.Selected.Value}; 
            Location:{Value:Dropdown2_1.Selected.Value}
         }
      )
   )

 

 

 



Farzad
Frequent Visitor

How can I upload some photos as an attachment for each row through the same code ?

With(
      {wScanID: 
      LookUp(
         Material_Inventory1; 
         HRSG1=Label1.Text
      ).ID};
      Patch(
         Material_Inventory1; 
         {ID: wScanID};
         { 
            QTY:Value(TextInput1.Text);
            Status: {Value:Dropdown2.Selected.Value}; 
            Location:{Value:Dropdown2_1.Selected.Value};
            Pic:{Attachment:DataCardValue18_1.Value}
         }
      )
   )

Pic is a new column in dataset. I made a DataCardValue (not in a form).

I tried the above but it does not work. 

Hi @Farzad ,

You cannot unfortunately - the only way (other than Power Automate) to upload attachments is using an Attachment control in a Form with either SubmitForm() or Patch(FormName.Updates)

Farzad
Frequent Visitor

Hi @WarrenBelz 

Thank you for your prompt response. How can I do that with SubmitForm()? or How can I add photos to a pre-made database/list (Adding photo in a new column) in Sharepoint through 

 

With(
      {wScanID: 
      LookUp(...

 

?

 

Hi @Farzad ,

As I noted, you cannot - if you have a Form with an attachment control and attachments uploaded to it, you can submit it and the attachments will be added to the record - the Patch of FormName.Updates does the same thing. The code I posted was for a completely different process as per your original request. There may be a Power Automate path with Add Attachment, but then you need to get the file from somewhere already saved/uploaded.

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,270)