cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
clare-sy
Frequent Visitor

update record with barcode scanner

Hi All,

 

I used barcode scanner in my app, in editform, the barcodescanner.value has been transfered to a label(lets call it "CTN" column) so that the label shows what scaner get;my code is below:

 

the label's default properity= If(IsBlank(Parent.Default),BarcodeScanner1.Value,Parent.Default)

 

which means if the label is blank(mostly in a newform ), then it shows the scanner's value;if label is not blank(maybe I  need to change some other value, I hope it stays originally, not changed);

 

 

 

but ,here is my question:

 

IF I need to update the "CTN“  in an item that already exists, I select the scanner, but the label's content stay the parent.default(even if I delete the content in label) , not my new scanner value.

 

 

 

Thank you!

 

clare

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @clare-sy ,

Do you mean that:

if CTN column is blank, the label display as blank by default;

if CTN column is not blank, the label display this item value by default;

There's a scanner button, if you click that to scan barcode, the label will display as new barcode value?

If so, you could set like this:
1)barcodescanner's OnScan:

 

Set(var,true)

 

2)CTN label's Text:

 

If(var,"aaa",Parent.Default)

 

 

Actually, no matter in edit mode or in new mode, "Parent.Default" represents this item's CTN value. If the form mode is new, "Parent.Default" value actually is blank. So no need to justify based on different form mode. You just need to justify whether you click the barcode scanner. If no, the label display based on form's mode. If yes, the label will display the scanner's scanned result.

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

4 REPLIES 4
VijayTailor
Resident Rockstar
Resident Rockstar

Hi,

You can use it like that.

If(IsBlank(Parent.Default),BarcodeScanner1.Value,If(!IsBlank(Parent.Default),Parent.Default,If( BarcodeScanner1.Value<>"Sample value" && !IsBlank(Parent.Default),BarcodeScanner1.Value)))

Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

hi, I have tested your code, I am not sure what do you means "Sample value" , in my case , every items contains different CTN value, I change the "Sample value"  into my CTN column, here is my code:

If(
IsBlank(Parent.Default), BarcodeScanner1.Value,
If(!IsBlank(Parent.Default),Parent.Default
If(And(BarcodeScanner1.Value <> ThisItem.CTN,!IsBlank(Parent.Default)),
BarcodeScanner1.Value
)))

but if I want to update my CTN value with barcode scanner , the value turns out to be the original value;

in my view, if the parent.default is not blank , the value would be parent.default because of code: If(!IsBlank(Parent.Default),Parent.Default

clare

Hi,

You can Achieve your requirement like Below. 

Step 1. Select BarCodeScanner and Set the OnScan Properties LIke that - UpdateContext({RescanBarCode:true})

VijayTailor_0-1600942948295.png

Setp 2 - Replace the TextInput1.Text  to Parent.Default . in below Formula.
If(RescanBarCode && TextInput1.Text <> BarcodeScanner1.Value,BarcodeScanner1.Value,TextInput1.Text)

VijayTailor_1-1600943060823.png

and Test.

Please find below  the Tested Screenshot from the Android Mobile

VijayTailor_0-1600943417728.png

 


Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


v-yutliu-msft
Community Support
Community Support

Hi @clare-sy ,

Do you mean that:

if CTN column is blank, the label display as blank by default;

if CTN column is not blank, the label display this item value by default;

There's a scanner button, if you click that to scan barcode, the label will display as new barcode value?

If so, you could set like this:
1)barcodescanner's OnScan:

 

Set(var,true)

 

2)CTN label's Text:

 

If(var,"aaa",Parent.Default)

 

 

Actually, no matter in edit mode or in new mode, "Parent.Default" represents this item's CTN value. If the form mode is new, "Parent.Default" value actually is blank. So no need to justify based on different form mode. You just need to justify whether you click the barcode scanner. If no, the label display based on form's mode. If yes, the label will display the scanner's scanned result.

 

 

Best regards,

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

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,393)