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

Barcode scan lookup from sharepointlist and return value

Hi, I am new to powerapps,trying to build app to help our production. 

The app intention is there will be a list of order no available in the sharepoint list, in powerapps operator will choose his name and machine he work, when he scan the barcode on the product he starting to work he will scan once and the barcode scan should lookup the scanned barcode is vailable in the list and if available update the current date & time on Edgestart & the name & machine info, when operator finish production of the order when operator scan for the second time the barcode scan should display the Edgestart(previous recorded value on Edgestart value) & register the Edgefinish on the sharepoint list for the order.

 

I am stuck with what formula to use ONProperty scan to patch the Edgestart(Datetime) & operatorname & machine on first time scan & just Edgefinish (datetime) on second time scan of the same product barcode. 

 

Any help is highly appreciated.

 

Thanks in advance.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Vinoth1_ ,

Based on the needs that you mentioned, I think the OnScan property of the Barcode Scanner , and the combination of Patch function and LookUp function could achieve your needs.

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the OnScan property of the Barcode Scanner control to following:

If(
   IsBlank(LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgestart')),
   Patch(
         Output_LookUp,
         LookUp(Output_LookUp, OrderNo  = Barcode_Scanner.Value),
         {
           'The Edgestart': Now(),
           'The Operatorname': OperatorNameDropdown.Selected.Value,
           Machine: MachineDropdown.Selected.Value
         }
   ),
   Patch(
         Output_LookUp,
         LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value),
         {
           'The Edgefinish': Now()
         }
   )
)

 

If you want to retrieve the Edgestart value and Edgefinish date time value within your app, please use the following LookUp formula:

The Edgestart Label Text property:

LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgestart')

The Edgefinish Label Text property:

LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgefinish')

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
WarrenBelz
Super User III
Super User III

Hi @Vinoth1_ ,

Try this method -  Note: you may have to validate the control references.

First Scan

UpdateContext({vScan:Barcode_Scanner.Value});
Patch(
   Output_Lookup,
   Defaults(Output_Lookup),
   {
      OrderNo:vScan,
      'The Operatorname':User().FullName
      Machine:'Machine_Dropdown value'.Selected.Value   //not sure here -valid reference required
      'The Edgestart':Now()
   }
)

then the second one

UpdateContext({vScan:Barcode_Scanner.Value});
UpdateIf(
   Output_Lookup,
   OrderNo=vScan,
   {'The Edgesfinish':Now()}
)

 

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.

v-xida-msft
Community Support
Community Support

Hi @Vinoth1_ ,

Based on the needs that you mentioned, I think the OnScan property of the Barcode Scanner , and the combination of Patch function and LookUp function could achieve your needs.

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the OnScan property of the Barcode Scanner control to following:

If(
   IsBlank(LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgestart')),
   Patch(
         Output_LookUp,
         LookUp(Output_LookUp, OrderNo  = Barcode_Scanner.Value),
         {
           'The Edgestart': Now(),
           'The Operatorname': OperatorNameDropdown.Selected.Value,
           Machine: MachineDropdown.Selected.Value
         }
   ),
   Patch(
         Output_LookUp,
         LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value),
         {
           'The Edgefinish': Now()
         }
   )
)

 

If you want to retrieve the Edgestart value and Edgefinish date time value within your app, please use the following LookUp formula:

The Edgestart Label Text property:

LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgestart')

The Edgefinish Label Text property:

LookUp(Output_LookUp, OrderNo = Barcode_Scanner.Value, 'The Edgefinish')

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@Vinoth1_ ,

Another approach from @v-xida-msft ,

Can you please tag whoever you want to continue this thread with.

Hi all,

 

Many thanks for the help. Formulas working good and generates results but with some little issue. Registry repeating.

 

LP0004 orderno is already listed in the sharepoint list,when 1st time scanned , it is creating another new registry below of initial LP0004 available data & register data of orderno, operatorname,machine,edgestart & edgesstop at the same time. 

when scanned for 2nd time, it updates the new time on Edgefinish on 1st scan registry & make another registry of LP0004 & associated dropdown results with new edgestart & Edgefinish.

 

Desired state is, LP0004 order no will be already available on the SP list, when scanned 1st time app will lookup LP0004 save dropdown data of operator name, machine and save the Edgestart(Now()). 

when scanned 2nd time, it will only update the Edgefinish (Now()) for LP0004 orderno.

 

Any help will be highly appreciated. Thanks in advance.

 

The actual results in the attachment.

 

Desired scenario can be in this way. if 

 

initial SP list

Initial_list.JPG

 

on 1st scan

Desiredresult_First scan.JPG

on 2nd scan

Desiredresult_2nd scan.JPG

 

 

 

 

Hi @v-xida-msft ,

 

Thanks for the solution, got the result expected.

 

I appreciate your help provided.

 

Regards,

Vinoth

Hi @WarrenBelz ,

 

For me learning is more important than the result itself. 

Irrespective of other solution worked, if found, can you tell me please what improvements we need to make in your proposed formulas so can make it work & get desired result? 

 

Thanks.

 

 

 

 

Thanks @Vinoth1_ ,

I would have allowed for that after your response as I was not entirely clear on your initial post, which was simply to see if that was the structure you needed.

You do have the option of accepting more than one response.

Hi,

One more additional question, can you help me with some different scenarios,

The Barcode which we use only have Orderno, and not anymore info.

Example,

Scenario 1:

LP0006 orderno is available on the SP list as one single entry. and this order has 2 color Glue white & Black, for 1st time scanning,when Operator name, machine and Glue color "White" choosen, it should register make a registry the results of Edgestart on under already existing Orderno & on 2nd scan , it updates the Edgefinish for White glue for LP0006 orderno.

 

Now LP0006 orderno registry for White Glue is already registered and available on the SP list. when Operator name, machine and Glue color "Black" choosen, it should make a new registry of Orderno LP0006 with operatorname, machine glue color & Edgestart(Datetime), & on 2nd scan, it updates the Edgefinish for Black glue for LP0006 for orderno.

 

 when Orderno:LP0006=barcode_scan,Glue=Empty,Edgestart=Empty, it will register it will register under LP0006  the operatorname(Vinoth),machine(1), glue(White),Edgestart(Now()), 2ns scan of same orderno LP0006, with Glue color (White), it register Edgefinish.

 

when Orderno:LP0006 is present as a previous registry for Black glue , but this time Glue is Black is choosen in the dropdown, it will create new register for LP0006  with the operatorname(Vinoth),machine(1), glue(Black),Edgestart(Now()), 2ns scan of same orderno LP0006, with Glue color (Black), it register Edgefinish.

 

Please can you propose what kind of formula i can try to achieve this?

 

Initial SP list

Initial_list.JPG

White & black color glue of same orderno scanned registered seperately.

Scan_white black seperately.JPG

Desired result

Result_LP0006.JPG

 

Hi @Vinoth1_ ,

Have you taken a try with solution I provided above? Is the solution helpful in your original issue?

 

If the solution I provided above could achieve your original issue, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

For your second question, you could consider open another new thread and describe the needs there, then we could help you solved your problem there.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (42,397)