Passing Data Between Screens
This page is for application designers who want to pass data changes between screens.
Overview
Sometimes an application user will make changes to data fields, and then expect to see those changes reflected on the next screen they use. In this case, use an actionflow to pass data between screens.
When passing data between screens:
- You have to pass the data from a form field to a form field
- You can only pass one record.
The examples used on this page assume Screen1 has a form field called Company Name, which displays data. Changes to the Company Name data has to be passed to Screen2, as shown below:
You can download the example data from the PhixFlow Learning Centre.
See the Designing Screens topic for information about creating and designing screens.
Configuring Actionflows to Pass Data
The following instructions assume you know how to set up an actionflow; see Understanding Actionflows.
Step 1 Create the actionflow
Find Screen2 in the repository and drag it onto the Screen1 canvas. PhixFlow automatically creates a button with an actionflow that opens Screen2; see Adding a Button to Open a Screen.
This actionflow only opens the new screen. You need to make changes to the actionflow so that the data is passed to Screen2.
- In the Screen1 canvas, right-click on the new button and select Display Actionflow to open the actionflow diagram.
Step 2 Configure the actionflow
In the actionflow Inputs panel, click on the On-Click event and select the origin of the data. In this example the origin is Screen1. PhixFlow opens the Mappings window.
- Drag the attributes you want to pass to the next screen from the left box to the right box.
In the example shown below, the left box lists the attributes available to Screen1 and we dragCompany Name
to the right box, which lists attributes available to Screen2. - In the actionflow, PhixFlow creates a connector called screen between in and Screen2 called screen only opens the screen. In this case we need to pass data. This means we need to remove the connector and create a new one.
- To remove the connector, in the actionflow, right-click on the connector to screen 2 and select Remove Connector, then Confirm the removal.
- Reconnect the Inputs → in connection point to Open (Screen 2). This time, PhixFlow opens a popup menu. Select Form, which allows data to pass. When prompted, select Screen 2.
- In the Mapping window, remap the attributes you want to pass to Screen2.
- Close the actionflow.
If you need to change the mapping later, to reopen the Mappings window, right-click on the line between the source of data and the connection point, then click Add Mapping.
Step 3 Test the actionflow configuration
- Open the Screen1 canvas and switch to Application Mode; see Design and Application Mode.
- In Screen1, edit the data in the
Company Name
field and click the button. - The application opens Screen2. The
Company Name
field should display your changes.
Passing a Calculated Value to Another Screen
When an application user moves from one screen to another, you may want to provide a new value on the second screen.
The following instructions explain how to calculate a value in the actionflow and then pass it to a screen.
Step 1 Create the form field
- Open Screen2.
- Add a form field from the palette
This field will hold the calculated value we want to pass to Screen2.
In the example this is calledCalculatedValue
. - Close Screen2.
Step 2 Update the actionflow
- Open Screen1 and unlock it if necessary
- Right-click on the button that opens Screen2 and select Display Actionflow.
- In the actionflow, click on the Screen2 node to open its properties.
- In Properties tab → Input Connection Points section, double-click the component where the data will be displayed to open its connection point properties.
In our example this is Screen2. - In the connection point properties → Properties tab → Attributes section toolbar, click Attributes.
- PhixFlow opens the list of attributes that are available. Drag the new
CalculateValue
attribute into the Attributes section, as shown below.
Step 3 Calculate the value
- From the actionflow toolbar, drag a Calculate onto the canvas. This type of node can perform calculations; see Calculate Node.
- Enter a name for the node and save your changes. In our example this is called
CalculateValue
. - Remove the connection between in and Screen 2.
- Reconnect the in connection point to the Calculate.
- Connect
CalculateValue
to Screen2 using the Screen2 form.
Updating Values on an Existing Screen
PhixFlow can update the values on a screen. For example, an application user enters a date and wants to calculate the number of working days to that date.
- Add a button to your screen.
- Right-click on the button and select Add Actionflow.
- Create an actionflow and add nodes to perform the required functionality; see Understanding Actionflows and Using Actionflow Nodes.
- In the connection points click Add New:
- Enter a Name.
- Select the Output.
In the popup window, select the form to which you want to write data.
You can only write data to a form field. You cannot write back to any other view type, such as a grid or card.
- Map your outgoing attributes to the available attributes; see Wiring Actionflows.
When the actionflow runs it will output the value from the actionflow to a form field in your original screen.