cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cindysitka
New Member

Single Scan bug or creator error?

I created a scan app in PowerApps that allows students to scan a qr code when they enter and exit a classroom.  My issue is sometimes after a scan it goes onto the next screen and sometimes it doesn't.  Sometimes it keeps the scanner screen open and so students will scan multiple times creating duplications in my list.    Ideally, after every scan, I would like it to go to my "success" page and show the input.  Did I do something wrong or is this a bug? Thanks

On Scan: Select(BarcodeScanner1);
Set(varSingleScan, BarcodeScanner1.Value);
Patch(Attendance, {Title: BarcodeScanner1.Value, Who: User().FullName, When: Now()});
Collect(collectScan, {BarcodeInfo: BarcodeScanner1.Value, WhoScanned: User().FullName, WhenScanned: Now()});
Navigate(Success)

2 ACCEPTED SOLUTIONS

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @cindysitka 

 

Please try the below code

With(
    {
        varSingleScan:  BarcodeScanner1.Value,
        UserInfo: User(),
        CurrentTime: Now()
    },
    Patch(
        Attendance,
        {Title: varSingleScan, Who: UserInfo.FullName, When: CurrentTime}
    );
    Collect(
        collectScan,
        {
            BarcodeInfo: varSingleScan,
            WhoScanned: UserInfo.FullName,
            WhenScanned: CurrentTime
        }
    );
    If(
     // check if there were any errors when the test score was submitted
        !IsEmpty(Errors('Attendance')),
     // if true, show any error message
        Notify(
            Concat(
                Errors('Attendance'),
                Column & ": " & Message
            ),
            NotificationType.Error
        ),
     // else, go to the success screen
        Navigate('Success');
    )
)

  

Ideally, when the student scans the QR code, it should get the information about the QR code and display it or consume it.

 

Question: Students are using their mobile or tablet for this?

 

View solution in original post

WarrenBelz
Super User
Super User

Hi @cindysitka ,

Why the first line (you have already selected it). The rest of the code looks OK. - you might try the below

Set(
   varSingleScan, 
   BarcodeScanner1.Value
);
Patch(
   Attendance, 
   Defaults(Attendance),
  {
      Title: varSingleScan, 
      Who: User().FullName, 
      When: Now()
   }
);
Collect(
   collectScan, 
   {
      BarcodeInfo: varSingleScan, 
      WhoScanned: User().FullName, 
      WhenScanned: Now()
   }
);
Navigate(Success)

 

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

5 REPLIES 5
StalinPonnusamy
Super User
Super User

Hi @cindysitka 

 

Please try the below code

With(
    {
        varSingleScan:  BarcodeScanner1.Value,
        UserInfo: User(),
        CurrentTime: Now()
    },
    Patch(
        Attendance,
        {Title: varSingleScan, Who: UserInfo.FullName, When: CurrentTime}
    );
    Collect(
        collectScan,
        {
            BarcodeInfo: varSingleScan,
            WhoScanned: UserInfo.FullName,
            WhenScanned: CurrentTime
        }
    );
    If(
     // check if there were any errors when the test score was submitted
        !IsEmpty(Errors('Attendance')),
     // if true, show any error message
        Notify(
            Concat(
                Errors('Attendance'),
                Column & ": " & Message
            ),
            NotificationType.Error
        ),
     // else, go to the success screen
        Navigate('Success');
    )
)

  

Ideally, when the student scans the QR code, it should get the information about the QR code and display it or consume it.

 

Question: Students are using their mobile or tablet for this?

 

WarrenBelz
Super User
Super User

Hi @cindysitka ,

Why the first line (you have already selected it). The rest of the code looks OK. - you might try the below

Set(
   varSingleScan, 
   BarcodeScanner1.Value
);
Patch(
   Attendance, 
   Defaults(Attendance),
  {
      Title: varSingleScan, 
      Who: User().FullName, 
      When: Now()
   }
);
Collect(
   collectScan, 
   {
      BarcodeInfo: varSingleScan, 
      WhoScanned: User().FullName, 
      WhenScanned: Now()
   }
);
Navigate(Success)

 

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.

 

 

cindysitka
New Member

Thank you!  These were all great solutions.  I am new to all of this.  I am just an elementary tech teacher trying to come up with innovative solutions and you helped me do that.    Our students have Surfaces and the Web Bar scanner feature was working so nice so the principal is allowing students to use their mobile devices.   Thank you again.

 

StalinPonnusamy
Super User
Super User

Great to hear the backgorund. Good effort.

@StalinPonnusamy ,

Good to see another advocate of the With() statement - it can be your best friend once you understand the power it has.

@cindysitka I know you said you are only starting here, but you might read this blog of mine.

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 (2,148)