Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Add: save result of apply expression attribute into current context for futher usages (#1305)
- Add: skipValue for expression to allow skip attribute when match with result of apply expression (#1353)
- Add: add hextostring transformation jexl function (#1367)
- Add: JEXL support to bidirectinal plugin
Expand Down
8 changes: 7 additions & 1 deletion lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,12 +769,18 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
}
} catch (e) {
logger.error(context, 'sendUpdateValueNgsi2 apply expression exception=%j', e);
res = ctxt[attr.name]; // TBD: add reference to test
if (attr && attr.name) {
res = ctxt[attr.name];
}
}
// jexl expression plugin
newAttr.value = res;

logger.debug(context, 'sendUpdateValueNgsi2 apply expression result=%j newAttr=%j', res, newAttr);
// update current context with value
if (attr && attr.name && ctxt[attr.name] !== undefined) {
ctxt[attr.name] = newAttr.value;
}
}

// Apply Multientity: entity_type and entity_name in attributes are in typeInformation.active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const iotAgentConfig = {
{
name: 'weather',
type: 'Summary',
expression: '"Humidity " + (humidity / 2) + " and pressure " + (pressure * 20)'
expression: '"Humidity " + (humidity / 2) + " and pressure " + (p * 20)'
},
{
object_id: 'a',
Expand Down