Skip to content

Commit

Permalink
allow metadata is still not in context after apply expression over a …
Browse files Browse the repository at this point in the history
…metadata2
  • Loading branch information
AlvaroVega committed Aug 6, 2024
1 parent a103f39 commit 5da8640
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,14 @@ function sendUpdateValueNgsi2(entityName, originMeasures, originTypeInformation,
currentAttr.metadata[metaKey] = newAttrMeta;

//RE-Populate de JEXLcontext
if (jexlctxt.metadata && jexlctxt.metadata[currentAttr.name]) {
jexlctxt.metadata[currentAttr.name][currentAttr.metadata[metaKey]] = metaValueExpression;
// It is possible metadata is still not in ctxt
if (!jexlctxt.metadata) {
jexlctxt.metadata = {};
}
if (!jexlctxt.metadata[currentAttr.name]) {
jexlctxt.metadata[currentAttr.name] = {};
}
jexlctxt.metadata[currentAttr.name][currentAttr.metadata[metaKey]] = metaValueExpression;
}
}
}
Expand Down

0 comments on commit 5da8640

Please sign in to comment.