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 / Inventory app, scan Na...
Power Apps
Unanswered

Inventory app, scan Name and serialnumber. Lookup, Update.

(0) ShareShare
ReportReport
Posted on by 36

Hi!

I have trouble with my inventory app. 

It works pretty fine except for some things.

 

I have two rows, name and serialnumber, but my code only takes the serialnumber. I want it to lookup both columns and check if data exists. Then I want to be able to update the data.

 

Now my app only creates a new row in Sharepoint for every scan with multiple values that are the same.

Can someone help me out?

 

Code Upload to Sharepoint button:
ForAll(
collectMultiScan As MyScan;
With(
{
wItem:
LookUp(
'Tablets Original';
Serialnumber = MyScan.BarcodeInfo
)
};
Patch(
'Tablets Original';
If(
IsBlank(wItem.Serialnumber);
Defaults('Tablets Original');
{Serialnumber: wItem.Serialnumber}
);
{
'Name (Title)': MyScan.BarcodeInfoQR;
Serialnumber: MyScan.BarcodeInfo

}
)
)
);;
Clear(collectMultiScan)

 

Code scan Title/serial

If(!var_scan_no;
Set(lastscanned;Patch(collectMultiScan;Defaults(collectMultiScan);{ID: CountRows(collectMultiScan) + 1;BarcodeInfoQR:BS_Single_3.Value}));;Set(var_scan_no;true);
Patch(collectMultiScan;{ID:lastscanned.ID};{BarcodeInfo:BS_Single_3.Value});;Set(var_scan_no;false));;Select(BS_Single_3)

20221209_084341000_iOS.jpg
Categories:
  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Hin82 ,

    The updating of an existing record using that pattern will only work with the ID 

    Patch(
     'Tablets Original';
     ForAll(
     collectMultiScan As MyScan;
     With(
     {
     wID:
     LookUp(
     'Tablets Original';
     Serialnumber = MyScan.BarcodeInfo
     ).ID
     };
     If(
     !IsBlank(wID);
     {ID: wID}
     );
     {
     'Name (Title)': MyScan.BarcodeInfoQR;
     Serialnumber: MyScan.BarcodeInfo
     }
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Hin82 Profile Picture
    36 on at

    Hi!

    Thx for reply!

    Dont really understand though, are you saying that I only need the code that you wrote or do I have to combine it with my in some way?

    Either way I cant get it to work with or without my code.

    Can you help me out? 

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Hin82 ,

    It should replace your code - I am assuming this following:-

    • collectMultiScan has a field called BarcodeInfo which is the Serialnumber field in the List 'Tablets Original'
    • You want to look at each record in collectMultiScan and either create a new record in 'Tablets Original' if the BarcodeInfo does not exist or update the existing record if it does

    If that is all correct, the code I supplied should work.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard