Hi,
I am working on an app to check in and out employees by only scaning their barcode.
I have a simple sharepointlist with all employees with their unique number=barcode.
I use a statusfield with status = Yes or No to identify if the employee is present or away.
By scanning the barcode, a timer starts with 4 seconds the status should be changed from yes to no or from no to yes without a submit button
How should I write the patch to scan and update the record?
So far I have:
Patch(aanwezigheidMedewerkers;
LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value);
{status: No}
)
(yes I know I have to add an ifstatement to check if current status is yes or no but first I want to make it work for yes to no change.)
Can someone help me out?
Thanks!
Solved! Go to Solution.
Hi @ejdregmans ,
Do you want to update an existing record in your SP List via scanning the unique barcode for each employee?
Actually, I think it is not necessary to add a Timer control to achieve your needs. I think the OnScan property of the BarcodeScanner control could achieve your needs.
Please set the OnScan property of the BarcodeScanner control to following:
Patch(
aanwezigheidMedewerkers;
LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value);
{
status: If(
LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value).status = true,
false,
true
)
}
)
Note: When assigning value to Yes/No type column in SP List, you need to use true or false Boolean value
Please take a try with above solution, check if the issue is solved.
Best regards,
Set(currentRecord, LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value));
Patch(
aanwezigheidMedewerkers;
currentRecord;
{
status: Switch(currentRecord,
Yes, No,
No, Yes
)
}
)
---
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."
Thanks @mdevaney but I am struggling to get your code working.
I get several errors and could not resolve it myself. Could you please have a look and test it? I am quite new in Powerapps.... Thanks in advance!
Status is Yes/No with required checked on
OK, then we cannot use the words YES & NO like you had initially. We must instead use true & false as shown below.
Set(currentRecord, LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value));
Patch(
aanwezigheidMedewerkers;
currentRecord;
{
status: Switch(currentRecord,
true, false,
false, true
)
}
)
---
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 @ejdregmans ,
Do you want to update an existing record in your SP List via scanning the unique barcode for each employee?
Actually, I think it is not necessary to add a Timer control to achieve your needs. I think the OnScan property of the BarcodeScanner control could achieve your needs.
Please set the OnScan property of the BarcodeScanner control to following:
Patch(
aanwezigheidMedewerkers;
LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value);
{
status: If(
LookUp(aanwezigheidMedewerkers;'medewerker number'=BarcodeScanner1_1.Value).status = true,
false,
true
)
}
)
Note: When assigning value to Yes/No type column in SP List, you need to use true or false Boolean value
Please take a try with above solution, check if the issue is solved.
Best regards,
Thanks a lot. This works! and yes without timer
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
199 | |
68 | |
47 | |
36 | |
25 |
User | Count |
---|---|
239 | |
109 | |
89 | |
87 | |
66 |