web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ReadNFC function until...
Power Apps
Answered

ReadNFC function until scanned

(0) ShareShare
ReportReport
Posted on by 186

Hi community!

 

I am building a POC for a timeclock system using an NFC tablet and Power Apps. The tablets are permanently mounted at entry and exit points in several locations. Staff use an NFC device, either a card or a digital wallet on their phone, to clock on and off by tapping their device against the tablet.

 

My app has a button called btnScanCard with the following code on the OnSelect property:

 

With(
 {nfcInput: ReadNFC()},
 IfError(
 nfcInput,
 If(
 FirstError.Message = "Tag not found",
 // No tag detected
 If(
 ckbAutoScan.Checked,
 // TODO: re-run the OnSelect of this control
 true
 ),
 // Error with detected tag
 Error(
 {
 Kind: ErrorKind.NotFound,
 Message: "We couldn't read your tag. Please try again."
 }
 )
 )
 );
 /*
 Lookup user and do stuff
 */
 If(
 !IsBlank(nfcInput),
 Navigate('Welcome User')
 )
)

 

 

I am running into issues with the ReadNFC() function not staying active for more than a minute or so. At which point, the button must be selected again. I need the NFC reader to be active until a device is scanned.

 

I've been trying to circumvent the self-referential rule by selecting controls which select this control, but Power Apps seems to be aware of all the indirect references. I've also tried using a checkbox, e.g., uncheck and check it and have the Select statement run on check; however, that approach didn't work.

 

I was able to navigate away from the screen and back to it and then run the Select() but that seems overkill. It's a simple while loop. Should I use a timer for this? 

 

Would love to hear some approaches to this.

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    lukas.schauffele Profile Picture
    186 on at

    I solved this by moving the code to a timer control and implementing a while loop similar to what is outlined here

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 337 Most Valuable Professional

#2
11manish Profile Picture

11manish 173

#3
Valantis Profile Picture

Valantis 86

Last 30 days Overall leaderboard