Skip to content
  • There are no suggestions because the search field is empty.

Calculations across an Instance

Use Instance Attributes to calculate and populate another Attribute of the same Instance.

The problem is due to the order of processing of the Components. We can't reference the resolved Instance Attributes to populate another Attribute of the same Instance.
 

Reference the source Component many times:

The simplest might be to make the calculation in the Attribute Expression. The trick is to reference the same source SparkplugB Input Component references separately in each Expression. Would this be appropriate in your case?
 

Use a Condition for the calculation, but the same source Component reference feeds the Condition and the Instance

To use a Condition to calculate one of the Attributes, the same Input SparkplugB Component must be Sourced instead of the Instance. In the following, att5 has the same calculation referencing the Condition.
 
 

Calculate and inject attribute in a Pipeline:

It might be more intuitive to make the calculation in a pipeline transform and assign the calculated result to the desired property. Here I'm calculating off of .att1, .att2, .att3 and assigning it to .att6.
Here I'm showing the Instance payload coming into the Pipeline:
And the transform expression:
The .att6 value has been updated:
 

4.0 feature: Initialization Block - stage the source Component in an Instance for referencing across many attributes

In 4.0 beta, an Initialization stage has been added to the Instance to helping make these sorts of calculations easier to see.