Skip to content

Commit 6c25d8b

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/azure-docs-pr into vm-ipv6
2 parents 4b14150 + 94fdf91 commit 6c25d8b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

articles/iot-hub/iot-hub-devguide-routing-query-syntax.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ deviceClient.sendEvent(message, (err, res) => {
142142
> [!NOTE]
143143
> This shows how to handle the encoding of the body in javascript. If you want to see a sample in C#, download the [Azure IoT C# Samples](https://github.com/Azure-Samples/azure-iot-samples-csharp/archive/main.zip). Unzip the master.zip file. The Visual Studio solution *SimulatedDevice*'s Program.cs file shows how to encode and submit messages to an IoT Hub. This is the same sample used for testing the message routing, as explained in the [Message Routing tutorial](tutorial-routing.md). At the bottom of Program.cs, it also has a method to read in one of the encoded files, decode it, and write it back out as ASCII so you can read it.
144144
145-
146145
### Query expressions
147146

148-
A query on message body needs to be prefixed with the `$body`. You can use a body reference, body array reference, or multiple body references in the query expression. Your query expression can also combine a body reference with message system properties, and message application properties reference. For example, the following are all valid query expressions:
147+
A query on a message body needs to be prefixed with `$body`. You can use a body reference, body array reference, or multiple body references in the query expression. Your query expression can also combine a body reference with message system properties, and message application properties reference. For example, the following are all valid query expressions:
149148

150149
```sql
151150
$body.Weather.HistoricalData[0].Month = 'Feb'
@@ -163,9 +162,16 @@ length($body.Weather.Location.State) = 2
163162
$body.Weather.Temperature = 50 AND processingPath = 'hot'
164163
```
165164

166-
> [!NOTE]
165+
> [!NOTE]
166+
> To filter a twin notification payload based on what changed, run your query on the message body:
167+
>
168+
> ```sql
169+
> $body.properties.desired.telemetryConfig.sendFrequency
170+
> ```
171+
172+
> [!NOTE]
167173
> You can run queries and functions only on properties in the body reference. You can't run queries or functions on the entire body reference. For example, the following query is *not* supported and will return `undefined`:
168-
>
174+
>
169175
> ```sql
170176
> $body[0] = 'Feb'
171177
> ```

0 commit comments

Comments
 (0)