Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

Passing data from one state to another

Of course, your Flux actions are not limited to services that just consume data, you could take that input and process it to pass around to other states. For this example, let's say you have two states. The first state is set to the action String StringMethods.upperCase(String), the second state is set to call String LoggerMethods.println(String), and there is a blank transition between them. Let us also say, that there is a single Flux input called input that is of type String.

For your first state:

  1. Click on your first state. Once the state is selected, Flux Input/Output will become State Input/Output.
  2. Under Output, right click and select Add > Add String. Provide a name. In this case, we will be using upperCased.
  3. In Mapper, map input to the action's input.
  4. As for the output, map the action's output to upperCased.

Passing data between states - first state

Passing data between states - first state

For your second state:

  1. Under the State Input/Output view, create an input of type string with the name toPrint.
  2. Going back to the Mapper, map toPrint to message.
  3. Finally, click on the transition arrow and in the Mapper, map upperCased to toPrint.

Passing data between states - second state

Passing data between states - second state

What we've done here is send data between two states using a transition. Data becomes available via a state's inputs and outputs and the transition acts as the bridge for data between states. This way, each state is isolated. They perform their own action without having to rely on other states' implementations. Transitions act as adapters between states.

Map properties using only keyboard commands!

To make it easier for you, Coder has template proposals you can use to map property values accessible via the content-assist menu.

To map properties using template proposals in the Design tab:

  1. Select the state or transition by clicking on it.
  2. Press the key; a pop-up will show with proposals.
  3. Select Map property.
  4. If the selection is a state and its action is an invoke step, there will be an Input or Output proposal. Select either of these options, depending on whether you want to set an input property or output property. Otherwise, ignore this step.
  5. Select the property to map.
  6. Select the property to map to the previously selected property.

Map property in Flux canvas using content assist

Map property in Flux canvas using content assist

To map properties using template proposal whilst in the Mapper view:

  1. Select a property in the Mapper view.
  2. Press the key; a pop up will show with proposals.
  3. Select Map to or Map from.
  4. Select the property to map it to or from.

Map property in Mapper using content assist

Map property in Flux canvas from Mapper View using content assist