Skip to content

Commit c5d1b16

Browse files
added details for enrich, filter and map sections
1 parent e8c78c8 commit c5d1b16

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

articles/iot-operations/connect-to-cloud/howto-create-dataflow.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,21 @@ Currently, the enrich operation isn't available in the operations experience por
401401

402402
# [Bicep](#tab/bicep)
403403

404+
For example, you could use the `deviceId` field in the source data to match the `asset` field in the dataset:
405+
404406
```bicep
407+
builtInTransformationSettings: {
408+
datasets: [
409+
{
410+
key: 'assetDataset'
411+
inputs: [
412+
'$source.deviceId', // Reference to the device ID from the source
413+
'$context(assetDataset).asset' // Reference to the asset from the dataset context
414+
]
415+
expression: '$1 == $2' // Expression to evaluate the inputs
416+
}
417+
]
418+
}
405419
406420
```
407421

@@ -455,6 +469,22 @@ To filter the data on a condition, you can use the `filter` stage. The condition
455469

456470
# [Bicep](#tab/bicep)
457471

472+
For example, you could use the `temperature` field in the source data to filter the data:
473+
474+
```bicep
475+
builtInTransformationSettings: {
476+
filter: [
477+
{
478+
inputs: [
479+
'temperature ? $last' // Reference to the last temperature value, if available
480+
]
481+
expression: '$1 > 20' // Expression to filter based on the temperature value
482+
}
483+
]
484+
}
485+
486+
```
487+
458488
# [Kubernetes](#tab/kubernetes)
459489

460490
For example, you could use the `temperature` field in the source data to filter the data:
@@ -490,6 +520,29 @@ In the operations experience portal, mapping is currently supported using **Comp
490520

491521
# [Bicep](#tab/bicep)
492522

523+
For example, you could use the `temperature` field in the source data to convert the temperature to Celsius and store it in the `temperatureCelsius` field. You could also enrich the source data with the `location` field from the contextualization dataset:
524+
525+
```bicep
526+
builtInTransformationSettings: {
527+
map: [
528+
{
529+
inputs: [
530+
'temperature' // Reference to the temperature input
531+
]
532+
output: 'temperatureCelsius' // Output variable for the converted temperature
533+
expression: '($1 - 32) * 5/9' // Expression to convert Fahrenheit to Celsius
534+
}
535+
{
536+
inputs: [
537+
'$context(assetDataset).location' // Reference to the location from the dataset context
538+
]
539+
output: 'location' // Output variable for the location
540+
}
541+
]
542+
}
543+
544+
```
545+
493546
# [Kubernetes](#tab/kubernetes)
494547

495548
For example, you could use the `temperature` field in the source data to convert the temperature to Celsius and store it in the `temperatureCelsius` field. You could also enrich the source data with the `location` field from the contextualization dataset:

0 commit comments

Comments
 (0)