Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: timonkIain,
Could you possibly post a description or example of what it is you are actually trying to do? I am not certain my answer will be in the right context otherwise.
In the aggregate node, to have variables that either increment or decrement by some value, you need to check them against the builtin agg functions "firstInGroup" and "lastInGroup".
For example:
##
if firstInGroup then Foo = 10
else Foo = Foo + 10 #or, you could say else Foo = Foo - 10
emit *, Foo as "New Foo"
where lastInGroup
##
In this example, the aggregate variable Foo will be incremented by +10 for each iteration through an aggregate group. If you wanted you could subtract 10 in the same fashion.
The variable lastInGroup can also be used in a similar fashion to set aggregate variables, or modify their value.
You can just as simply use input or parameter values.
if firstInGroup then Foo = (<FIELD ONE VALUE> - <FIELD TWO VALUE> )/{{^a graph parameter^}} + {{^a node parameter^}}
Regards
Timon Koufopoulos
MDA Support.