- Created by Anthony George, last modified on Jan 20, 2023
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 5 Next »
Explanation
The ability to pass data between screen is very useful, it can be used to a record ID from a grid and pass it to an edit form 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 topic of actionflows is beyond the scope of this course, however we will cover some of the basics.
Example
In 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 create a new actionflow to pass a label between the screens Companies List and Companies Form, to inform they are editing or adding a record.
About Actionflow
To understand actionflows see Understanding Actionflows. A simple overview is that 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 used, 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. There is a show instances button that lists everywhere an actionflow is used.
Accessing Actionflows
- The two most common means of accessing an Actionflow are:
- Right-click a button and select Display Actionflow.
- Alternatively click on a button to open its properties. Select the Actionflow tab and click the Actionflow hyperlink.
Existing Actionflow Review
- 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 click and no data is being sent in. This is in contrast to the actionflow for the edit button which is set to be be the Companies grid which allows data from the grid to be used.
- On the canvas we can see a single action node, of the type Open Screen. Click on this to see which its configuration.
- Close the actionflow.
- 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 but the data from the selected record on the companies grid is now 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.
- Later in this chapter we will recreate this actionflow and pass across more information.
- Close the mapping popup.
- The connections mapping is unique to each instance of the 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.
- 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 screen and the Companies Form screen.
- From 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.
- Set Name to
Edit Company
and click Confirm. - Click on Connect
- A number of options appear as we are able to select data from any of the data bound components e.g. table and pie chart.
- Select Companies - View Component, and click Connect Input.
- The mappings open
- What data is being used?, set this to
Selected
. - Drag
CompanyID
andComapnyName
to the right. - Click Confirm Mappings.
- What data is being used?, set this to
- From the Actionflow Toolbar drag a Calculate action onto the canvas.
- set Name to, M
essage
.
- set Name to, M
- Drag the incoming Connection point onto the calculate.
- 7
- Right click on the pipe, in, and select Configure Mapping.
- 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 .
- Set Name to be 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.
- Set Name to be 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 Screen.
- This is an alternative method of creating action nodes.
- When prompted provide a name and select Company Form as illustrated below:
- In the Mapping dialog,
- 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.
In the event we wanted to pass data to the screen and not display it, perhaps we want to use it 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 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? We the simplest method is to set the default message on the Company Form screen to be "Adding New Company", The default will be used where no message is set. This is achieved as follows:
- Open Companies Form.
- Select the header, this is called Company.
- In its properties, set Default Message to be, Adding a New Company.
Restrict Width of 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 Style
- In the repository window expand Packages → Serene Grey → Style
- Search for: Text Overflow
- Drag
P_SG - Text Overflow Ellipses
into the Shared Styles section of the Company header.
- In the CSS Properties Section add a new style with the following values:
- CSS Tag,
maxWidth
- Value,
250px
- Save your changes.
- CSS Tag,
- No labels