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)
Solved! Go to Solution.
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?
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.
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?
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.
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.
Great to hear the backgorund. Good effort.
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.
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
181 | |
137 | |
96 | |
83 |