cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vinoth1_
Helper IV
Helper IV

Patch data into sharepoint

Hi All,

 

Capture.JPG

 

I try to develop app to record production output.

 

example, Operator choose their name, product, process -- & scan barcode of order. for the first scan it will collect the initial record of operator name, product, process and start time. 1 st time scan of the order denotes order started, 2nd time of same order denotes order finish.

i used this formula for scan & save data

Patch(
    'Aluminium Output',
    Defaults('Aluminium Output'),
    {
        Orderno:BarcodeScanner1.Value,
        Start:Now(),
        Product:Product.SelectedText.Value,
        Process:Process.SelectedText.Value,
        Operator:Operator.SelectedText.Value
        }
        )

 

 and the value get saved in sharepoint list,

Capture1.JPG

 

 

for the second time scan of the same barcode it denotes the order completed and lookup the order no & save the finish time.

 

i am struck here, what formula to use, when same order no scanned for 2nd time will lookup the value on sharepoint list and patch the finish time.

 

(1st time scanned it create new record in sharepoint list, 2nd time scan of same order it patch finish time for that order no)

 

any help is highly appreciated.

 

 

1 REPLY 1
Guillaume_G
Advocate I
Advocate I

Hi,

 

In the On Scan property, on the first scan, you check if the barcode value exists in a collection (an 'empty'collection could have been created from the On Visible property). If it does not exist, you collect the barcode value into this collection and you patch your SP list as you described in your original post (you create the SP record in this call).

If the record exists in your collection, this is your second scan. In this case, you clear the collection and you patch the SP list with only the Finish value.

 

I went for the collection scenario to avoid multiple calls to the SP list, which may make the user experience not so great. However, if you do not want to use a collection together with your SP list, you can carry out a lookup on the SP list in your On Scan property and the rest of the logic is similar to the above: if a record is found, this is your second scan; if not record is found, this is your first scan.

 

Just a few questions to understand your requirements:

What is the elapsed time likely to be between scan 1 and scan 2? Is the operator likely to start several orders concurrently?

Also, is it a necessity that the operator needs to scan the barcode a second time to finish the order, could the operator not just be presented with a 'Finish' button to press once the order is complete? If this is a possibility, once the operator has carried out a scan, you can swap the scan button for a finish button.  

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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