Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You have a calculate stream processing, say, 10,000 records - and you want to accumulate totals based on a key value, of which there are around 100 across the data set. For each key value, many records will be added to the total. To do this, you should use an call to the cache function such as:

Code Block
...
cache ( _out.KeyVal,
    if (_cacheValue == _NULL,
		$currentValue = 0
	, // else
		$currentValue = _cacheValue
	),
	$currentValue = $currentValue + _out.CashValue,
	$currentValue
)
...

...

Code Block
...
$currentValue = cache(_out.KeyVal),
if ($currentValue == _NULL,
	cache(_out.KeyVal, _out.CashValue)
, // else
	cache(_out.KeyVal, $currentValue + _out.CashValue)
),
...

Syntax

cache(cache key, expression1, expression2, [,..., expressionN])

...