Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Explanation
The ability to pass data between screen screens is very useful, it can be used to pass the ID of a record ID from a grid and pass it on one screen to an edit form on another, or it can be used to simply pass a useful label that indicates the activity being performed. The passing of data is performed by actionflows. The full topic of actionflows is beyond the scope of this course, however, we will cover some of the fundamentals on this course. To understand more about actionflows see Understanding Actionflows.
Example
Use CaseIn our example, we will first look at the actionflow PhixFlow created earlier in this course that allows us to edit a company record. We will then edit this actionflow create a new actionflow that builds on this to pass a label between the screens Companies List and Companies Form , to inform the user they are editing or adding a record.
About Actionflow
A simple overview of actionflows; actionflows are created and then an instance of the actionflow is applied to a button or event such as a double-click. The actionflow has a connection point and each time the actionflow is applied, i.e. each instance, data is mapped in. This connection mapping is what allows actionflows to be reusable. Therefore caution is needed when editing an actionflow that is used in multiple places as changes will impact all instances.
SetupThere is a show instances button that lists everywhere an actionflow is used that can assist you with this.
Below is a logical example of an actionflow that handles an area code and derives a country from it. We only want to create this once so the logic is managed in a single actionflow, but we will want it used in multiple places. The actionflow is reused by the two applications shown on the left. The actionflow is owned by a package that is shared between the applications. Each application has separate data with different fields. The actionflow takes data from:
Postcode
data in the Contact App.Zip Code
in the Asset Manager App.
This shows that an actionflow can take its input from an attribute with any name, as it gets mapped onto the input connection point and it is this that the actionflow uses. Our example below is one actionflow with two instances:
- Instance 1 is the actionflow with input from
Postcode
- Instance 2 is the actionflow with input from
Zip Code
Image Added
Accessing Actionflows
- The two most common means of accessing an Actionflow are as follows, both open an instance of an actionflow:
- Right-click a button and select Display Actionflow.This opens the instance of an actionflow associated with this button.
- Alternatively, click on a button to open its properties. Select the
tab and click the Actionflow hyperlink. This too opens the instance of an actionflow associated with this button.Insert excerpt _actionflow _actionflow nopanel true
Existing Actionflow Review
- The Add Actionflow
- On the Companies List screen, open the actionflow for the Add button.
- In the Connections on the left, the connection is set to On Click. This stipulates that the actionflow is triggered by a mouse click and no data is being sent in. This is in contrast to the actionflow for the edit button which is set to collect data from the Companies grid.
- On the canvas, we can see a single action node, of the type Open Screen. Click on this to see its configuration. This is set to open a screen when this button is clicked.
- We do not need to make any changes here. Close the actionflow.
- The Edit Actionflow
- From the Companies List screen open the actionflow for the Edit button.
- In the Connections on the left, the connection is set to Companies, specifically the selected record. This stipulates that the actionflow is still triggered by a click and the data from the selected record on the companies grid is passed to the actionflow.
- Right-click on the in pipe in the connections section and select Configure Mappings.
- We see that the CompanyID is passed in.
Image Added
- Later in this chapter, we will recreate this actionflow and pass on more information.
- Close the mapping popup.
- The connections mapping is unique to each instance of an actionflow.
- In the main area of the actionflow right-click on the line, known as a pipe, connecting In to Open Edit Form.
- Select Configure Mappings.
- These mappings are set up once on the Actionflow, only the incoming mappings should change for each instance.
- Here we see the CompanyID provided to the actionflow mapped to the CompanyID field on the Company Form screen.
- The CompanyID field on the Companies Form is hidden but can be located in the layers section.
- In the Actionflow header bar, we can see that Show All Instances has 1 next to it to indicate the number of places this is being used. Clicking this link will show you that location.
Creating a Simple Actionflow
The actionflows we have looked at so far are part of the Serene Grey template and form the basis of simple add and edit actions. For this reason, we will not edit them but create a new actionflow for our specific use case of passing information between the Companies List and the Companies Form screens.
- On the Companies List screen, click on the Edit button.
- Click on the Action tab.
- Click
next to Actionflow to add a new actionflow. This will automatically replace the existing edit actionflow.Insert excerpt _addIcon _addIcon nopanel true - Set Name to
Edit Company
and click Confirm.
- Set Name to
- Click on Connect
- A number of options appear as we are able to select data from any of the data-bound components on the screen e.g. table and pie chart.
- Select Companies - View Component, and click Connect Input.
- Image Added
- The mappings open:
- What data is being used?, set this to
Selected Records
. - In the main mapping area, drag
CompanyID
andComapnyName
to the right. This creates an input attribute that is passed into the actionflow, this is only required when setting up the actionflow, future instances will simply map to these attributes: - Image Added
- Click Confirm Mappings.
- What data is being used?, set this to
- From the Actionflow Toolbar drag a Calculate action onto the canvas.
- Name, M
essage
.
- Name, M
- Drag the Input Connection Point onto the Calculate action as illustrated below:
- Image Added
- Right-click on the pipe, in, (the one in between the Input Connection Point and the Calculate).
- Drag CompanyName from the left to the right, this creates a mapping so we can later access this data.
- Click Confirm Mapping.
- Click on Message and its properties open on the right.
- In the Calculate Attributes section, click
.Insert excerpt _addIcon _addIcon nopanel true - Name, Edit
Message
. - Expression,
- The expression has access to any of the data mapped into this action node i.e. CompanyName.
- Set this to be
"Edit: " + in.CompanyName
.
- Save your changes.
- Name, Edit
- In the Calculate Attributes section, click
- Hover over Message and click out. An arrow is activated.
- Drag this to the right and click in an empty space.
- Select
.Insert excerpt _screen _screen nopanel true - This is an alternative method of creating action nodes.
- When prompted provide a name and select Company Form as illustrated below:
- Image Added
- In the Mapping dialogue,
- Drag EditMessage to Company.
- Company is the name of the dynamic header field we setup earlier in the course.
- Drag CompanyID to CompanyID.
- CompanyID will be used to show the company we selected.
- Drag EditMessage to Company.
- Click Confirm Mappings.
- Save all your changes. Make sure you save the change on the original Edit button.
Tip |
---|
In the event we wanted to pass data to the screen and not display it, perhaps we want to use the data in a filter, then add a form field to the hidden area on the screen. This form field can then be mapped to and used in a filter or for other purposes. |
Testing
Lock your Company List screen select a record and click Edit. The header will now display the new message we set.
Additional Configuration
Add Company Message
What about if we want to set a message for the Add button to let the user know they are adding a new record? The simplest method to do this is to set the default message on the Company Form screen to "Adding New Company", this will then be used where no message is set. This is achieved as follows:
- Open the Companies Form screen.
- Select the header, this is called Company.
- In its properties, set Default Message to be,
Adding a New Company
.
Restrict the Width of a Title
Selecting a company with a large name causes the title to wrap in an undesirable way. We can tell the header to not wrap and use ellipsis (...) to show the title has been cropped.
- Open the properties for the Company header.
- Select the Styles tab.
- In the Shared Styles section
- Click
Insert excerpt _styles _styles nopanel true - In the repository pane, expand Packages → Serene Grey → Styles
- Search for:
Text Overflow
- Drag
P_SG - Text Overflow Ellipses
into the Shared Styles section of the Company header.
- Click
- In the CSS Properties section add a new style with the following values:
- CSS Tag,
maxWidth
- Value,
250px
- Save your changes.
- CSS Tag,
- Image Added