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

AutoStart Barcode Scan (Always on Scanner)

Hi All,

I have created an Attendance system using barcode scanner that Scan QR code and check-In scanned user. same as check-out.

Each time I have to touch the barcode scanner and then only it starts scanning.

But I need this to be always on scan, which means when I put my QR code to the camera it starts the scan automatically. without touching.

can you please help me to do this?

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @ShehanPeiris ,

I have to say firstly that I have just tested the below and it seems to work, however I am sure the control was not designed to operate this way.

On the OnScan of your barcode control (I will call it BarcodeScanner1 below), after anything else you have there, put 

Select(BarcodeScanner1)

and it selects and starts the scanner again. I successfully scanned about a dozen items with an iPad, but with no other code happening in the background. Please let me know how this works for you.

 

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.

 

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @ShehanPeiris

Do you want to keep the BarcodeScanner always open(or Automatically open the BarcodeScanner)?

I have 2 solution for your reference:

Solution1: Using a timer to automatically open BarcodeScanner

1\add two screens(barcodescanner screen; successmessage screen)

At barcodescanner screen:

2\add a barcodescanner(BarcodeScanner1) control.

Set its onscan property to:

 

Patch(
Employeetable,   /*my data source*/
LookUp(Employeetable, EmployeeID=BarcodeScanner1.Value),
{
status: “check-In”
}
); /*This code is my demo, you can customize this code according to your needs*/
Navigate(‘successmessage screen’)

 

When the scan is successful, navigate to successmessage screen

3\add a timer control

Set its property

AutoStarttrue

Duration1000  /* means 1s ,modify it as you like*/

OnTimerEnd: Select(BarcodeScanner1);

Reset:true

Visible:false

Wait for 1s then open the camera

At successmessage screen:

4\add a timer control

Set its property

AutoStarttrue

Duration3000  /*means 3s,modify it as you like*/

OnTimerEnd: Navigate(barcodescanner screen)

Reset:true

Visible:false

Wait for 3s then navigate to barcodescanner screen

Solution2: Using web barcode scanner control to keep the camera open.

1\ you need to enable this feature(file-settings-advanced setings-web barcode scanner)

 

2\add a web barcode scanner control(Barcode1)

3\add a timer control and set its property:

AutoStart:true

Duration:2000 /*wait for 2s*/

OnTimerEnd:

 

If(
    !(Barcode1.Text = VarVar),
    Set(
        VarVar,
        Barcode1.Text
    );
    Patch(
Employeetable,   /*my data source*/
LookUp(Employeetable, EmployeeID=VarVar),
{
status: “check-In”
}
)
)

 

Repeat: true

Visible:false

Check the value of Barcode1.Text every two seconds, If Barcode1.Text is updated, the employee status is updated

 

Best Regards,

Bof

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @ShehanPeiris ,

I have to say firstly that I have just tested the below and it seems to work, however I am sure the control was not designed to operate this way.

On the OnScan of your barcode control (I will call it BarcodeScanner1 below), after anything else you have there, put 

Select(BarcodeScanner1)

and it selects and starts the scanner again. I successfully scanned about a dozen items with an iPad, but with no other code happening in the background. Please let me know how this works for you.

 

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.

 

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @ShehanPeiris

Do you want to keep the BarcodeScanner always open(or Automatically open the BarcodeScanner)?

I have 2 solution for your reference:

Solution1: Using a timer to automatically open BarcodeScanner

1\add two screens(barcodescanner screen; successmessage screen)

At barcodescanner screen:

2\add a barcodescanner(BarcodeScanner1) control.

Set its onscan property to:

 

Patch(
Employeetable,   /*my data source*/
LookUp(Employeetable, EmployeeID=BarcodeScanner1.Value),
{
status: “check-In”
}
); /*This code is my demo, you can customize this code according to your needs*/
Navigate(‘successmessage screen’)

 

When the scan is successful, navigate to successmessage screen

3\add a timer control

Set its property

AutoStarttrue

Duration1000  /* means 1s ,modify it as you like*/

OnTimerEnd: Select(BarcodeScanner1);

Reset:true

Visible:false

Wait for 1s then open the camera

At successmessage screen:

4\add a timer control

Set its property

AutoStarttrue

Duration3000  /*means 3s,modify it as you like*/

OnTimerEnd: Navigate(barcodescanner screen)

Reset:true

Visible:false

Wait for 3s then navigate to barcodescanner screen

Solution2: Using web barcode scanner control to keep the camera open.

1\ you need to enable this feature(file-settings-advanced setings-web barcode scanner)

 

2\add a web barcode scanner control(Barcode1)

3\add a timer control and set its property:

AutoStart:true

Duration:2000 /*wait for 2s*/

OnTimerEnd:

 

If(
    !(Barcode1.Text = VarVar),
    Set(
        VarVar,
        Barcode1.Text
    );
    Patch(
Employeetable,   /*my data source*/
LookUp(Employeetable, EmployeeID=VarVar),
{
status: “check-In”
}
)
)

 

Repeat: true

Visible:false

Check the value of Barcode1.Text every two seconds, If Barcode1.Text is updated, the employee status is updated

 

Best Regards,

Bof

View solution in original post

Hi @WarrenBelz ,
yes, you are correct. I used Select() method to auto start the reader with timer control and it works well now.

Thank you very much for your support.

Hi @v-bofeng-msft ,
I did exactly the same way. used scanner screen, success screen and after 5 seconds it comes back to scanner screen, the scanner starts again, once finish navigate to success or failed screen likewise I have created my app with timer controls.

Thanks a lot for your support, this really helped me a lot.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,250)