Skip to content

Commit c994967

Browse files
authored
Merge pull request #4717 from MicrosoftDocs/gregli-readnfc
Initial docs for ReadNFC function
2 parents 3ee9b24 + 46d546f commit c994967

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

powerapps-docs/maker/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,8 @@
759759
href: ./canvas-apps/functions/function-trig.md
760760
- name: Rand
761761
href: ./canvas-apps/functions/function-rand.md
762+
- name: ReadNFC
763+
href: ./canvas-apps/functions/function-readnfc.md
762764
- name: Refresh
763765
href: ./canvas-apps/functions/function-refresh.md
764766
- name: Relate

powerapps-docs/maker/canvas-apps/formula-reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ Other elements include:
276276

277277
**[Rand](functions/function-rand.md)** – Returns a pseudo-random number.
278278

279+
**[ReadNFC](functions/function-readnfc.md)** – Reads a Near Field Communication (NFC) tag.
280+
279281
**[Refresh](functions/function-refresh.md)** – Refreshes the records of a data source.
280282

281283
**[Relate](functions/function-relate-unrelate.md)** – Relates records of two entities through a one-to-many or many-to-many relationship.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: ReadNFC function | Microsoft Docs
3+
description: Reference information, including syntax, for the ReadNFC function in Power Apps
4+
author: gregli-msft
5+
manager: kvivek
6+
ms.service: powerapps
7+
ms.topic: reference
8+
ms.custom: canvas
9+
ms.reviewer: nabuthuk
10+
ms.date: 06/16/2021
11+
ms.author: gregli
12+
search.audienceType:
13+
- maker
14+
search.app:
15+
- PowerApps
16+
---
17+
# ReadNFC function in Power Apps
18+
19+
Reads a Near Field Communication (NFC) tag.
20+
21+
## Description
22+
23+
Use **ReadNFC** function to read an NFC tag that is close to your device. When invoked, the screen displays instructions for scanning an NFC tag, and only returns after the tag has been scanned or a timeout expires.
24+
25+
**ReadNFC** returns a record of information about the tag that has been read. The record contains:
26+
27+
| Column | Type | Description |
28+
|----|----|----|
29+
| **RTD** | Text | The tag's Record Type Definition (RTD). Only *RTD_TEXT* and *RTD_URI* are supported at this time. |
30+
| **TNF** | Number | The tag's Type Name Format (TNF). Only *TNF_WELL_KNOWN* is supported at this time. |
31+
| **Text** | Text | The text payload of the NFC tag if RTD is *RTD_TEXT*, *blank* otherwise. |
32+
| **URI** | Hyperlink | The URI payload of the NFC tag if RTD is *RTD_URI*, *blank* otherwise. |
33+
34+
If the tag is not supported, for example, the TNF is not *TNF_WELL_KNOWN*, or the scan timed out, then the record itself will be *blank* (and all the columns will be *blank* too).
35+
36+
Always check the payload value for *blank* using the [**IsBlank**](function-isblank-isempty.md) function before using it. You do not need to check the **RTD** and **TNF** values yourself as they must be the correct values for **Text** and **URI** to have a non *blank* value.
37+
38+
Additional **RTD** and **TNF** values may be supported in the future. If more values are supported, additional payload columns will also be added. The raw **RTD** and **TNF** values are provided for informational purposes. More information about these values and their use is available through the [NFC Forum](https://nfc-forum.org) and many other books and articles on NFC.
39+
40+
If NFC is not supported on the device, a message will be shown to the user and the function will return a *blank* record.
41+
42+
**ReadNFC** can only be used in [behavior formulas](../working-with-formulas-in-depth.md).
43+
44+
## Syntax
45+
46+
**ReadNFC**()
47+
48+
## Examples
49+
50+
Reads an NFC tag and displays the result. If the result is Text or URI, displays that value to the user. The [**With**](function-with.md) function is used to make the columns of the return record easily accessible.
51+
52+
```powerapps-dot
53+
With( ReadNFC(),
54+
If( Not IsBlank( Text ),
55+
Notify( "Read Text: " & Text ),
56+
Not IsBlank( URI ),
57+
Notify( "Read URI: " & URI ),
58+
Notify( "Didn't read Text or URI" )
59+
)
60+
)
61+
```
62+
63+
Reads an NFC tag and displays type information about the result.
64+
65+
```powerapps-dot
66+
With( ReadNFC(), Notify( "Tag TNF: " & TNF & ", RTD: " & RTD ) )
67+
```
68+
69+
Collects read NFC tags for later use.
70+
71+
```powerapps-dot
72+
Collect( ScannedTags, ReadNFC() )
73+
```
74+
75+
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)