Skip to main content
Version: Current

PreviousValue

Mode: Streaming

Description​

The PreviousValue node recalls a value that was captured during a previous occurrence of an event with a specific key. It allows you to access the last seen value of a given expression for each group of events defined by a grouping key.

Parameters and configuration​

NameDescription
Output variable nameThis variable will contain the last value seen for the particular grouping key
Key byOne or more expressions that define how input events are grouped. The component keeps track of the last value separately for each unique combination of their values. Defaults to an empty list {}, so one value is kept for the whole stream.
UI tip: After entering each Key by expression, press Enter to add it. To edit an existing expression, click it.
ValueThe value to remember. It will be recalled when another event with the same grouping key arrives.

Example​

Given stream of events which contain users with their current location, when we set

  • Key by as #input.userId
  • Value as #input.location

then the value of the output variable is the previous location for the current user. If this is the first appearance of this user, the current location will be returned.