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

Community site session details

Session Id : PC6D22EDKIh+AvoZljtIUP
Power Apps - Building Power Apps
Answered

ReadNFC function until scanned

Like (0) ShareShare
ReportReport
Posted on 27 Jul 2023 08:10:39 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

I have the same question (0)
  • Verified answer
    lukas.schauffele Profile Picture
    186 on 27 Jul 2023 at 23:16:54
    Re: ReadNFC function until scanned

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 892 Most Valuable Professional

#2
Power Apps 1919 Profile Picture

Power Apps 1919 356

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 310 Super User 2025 Season 2

Last 30 days Overall leaderboard