Hi, I'm building a personnel on board tracking system.
the ideas is so simple. every time you scan the qr code, it will be patched into the datasource.
the question is, how to make patch formula so if a employee who last scan "CHECKED IN", then the next patch input automatically be "CHECKED OUT".
and if the employee scan the QR code again, it will be patched as "CHECKED IN" again.
i tried this formula but it doesn't work.
OnScan=
Patch(Table1,{CICO:If(IsMatch(Last(Filter(Table1,Name=BarcodeScanner1.Value).CICO).CICO,"IN"),"OUT",
IsMatch(Last(Filter(Table1,Name=BarcodeScanner1.Value).CICO).CICO,"OUT"), "IN")
,
Name:BarcodeScanner1.Value,
Date:Text(Now(),"dd/mm/yyyy"),
Time: Now() })
thanks
Hi @ahmadfurqan ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
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.
Visit my blog Practical Power Apps
Hi @ahmadfurqan ,
Firstly, note that Date and Time are very bad names for fields, but I have included them in the below for structure
With(
{
wScan:
LookUp(
Sort(
Table1,
ID,
Descending
),
Name = Self.Value
)
},
If(
wScan.CICO = "IN" && IsToday(DateValue(wScan.Date))
Patch(
Table1,
{ID: wScan.ID},
{
CICO: "OUT",
Date: Text(Now(),"dd/mm/yyyy"),
Time: Now()
}
),
Patch(
Table1,
Defaults(Table1),
{
CICO: "OUT",
Date: Text(Now(),"dd/mm/yyyy"),
Time: Now()
}
)
)
)
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.
Visit my blog Practical Power Apps
@ahmadfurqan
I have moved your post to correct section so you will get quicker response for help, going forward if you need any help post it this section please
https://powerusers.microsoft.com/t5/Power-Apps-Community/ct-p/PowerApps1
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional