Skip to content

Commit

Permalink
Merge pull request #1444 from telefonicaid/AlvaroVega-patch-1
Browse files Browse the repository at this point in the history
Update entities-NGSI-v2.js (just a comment)
  • Loading branch information
fgalan authored Sep 14, 2023
2 parents 1199e43 + 65c0ddf commit 1b7c8b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,10 @@ will check which ones contain expressions whose variables are present in the rec
whose variables are covered, their expressions will be executed with the received values, and their values updated in
the Context Broker.

If as a result of apply expression `undefined` or `null` value is obtained then any of them will not progress to entity
attribute. Have into acount that some numeric operations results (like nonexistent \* 2) are a kind of null with a
number type but NaN value, which will also not progress to entity attribute.

E.g.: if a device with the following provisioning information is created in the IoT Agent:

```json
Expand Down
5 changes: 3 additions & 2 deletions lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,9 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
if (expressionPlugin.contextAvailable(attr.expression, ctxt, typeInformation)) {
res = expressionPlugin.applyExpression(attr.expression, ctxt, typeInformation);
if (
// By default undefined is equivalent to null: should not progress
// NaN should also not progress
// By default undefined is handled like null: should not progress
// Some op results (like nonexistent * 2) are a kind of null with a number type
// but NaN value
(attr.skipValue === undefined &&
(res === null || (typeof res === 'number' && isNaN(res)))) ||
(attr.skipValue !== undefined &&
Expand Down

0 comments on commit 1b7c8b7

Please sign in to comment.