This exercise is based around a parcel delivery service Apollo Parcels. When parcels cannot be delivered, customers can request redelivery on a certain date, and give a target redelivery time. |
...
...
Action to open another dashboard – filtered for selected row
By the end of this section you will be able to:
...
You will create an action to review delivery slots for a requested redelivery. The candidate slots presented will be chosen based on matching the delivery zone and redelivery date requested by the customer.
- Open the model
Dashboards and Forms 14. Actions to open other dashboards, action validation
- Go to the Stream stream
Apollo Deliveries
, and open the viewApollo Deliveries
to see the data - Go to the Stream stream
Apollo Delivery Slots
, and open the viewApollo Delivery Slots
to see the data
First, create two dashboards:
- Create a dashboard
Apollo Manage Redeliveries
- Drag the view
Apollo Deliveries
on to the dashboard - Press to show all buttons
- Press to show the view details on the dashboardRight click on the view and go to Dashboard Options → Show Element Details
- Update the Element
- Name to:
ApolloDeliveries
Press - Press
- Resize your view on the dashboard, and press to save your layout changes
- Drag the view
- Create a dashboard
Apollo Delivery Slots
- Drag the view
Apollo Deliveries Slots
on to the dashboard - Press to show all buttons
- Press to show the view details on the dashboardRight click on the view and go to Dashboard Options → Show Element Details
- Update the Element Name to:
ApolloDeliverySlots
- Press
- Press Resize your view on the dashboard, and press to save your layout changes
- Drag the view
Now add the action:
- Open the configuration form for the Stream stream
Apollo Deliveries
Go to the Actions tab section
- Press to create a new action
- Give the action the following configuration:
- Name:
Review Redelivery Slots
- Display Name:
Review Redelivery Slots
- Go to the Action Completion section
- Tick Open Post Dashboard:
- Press - Apply
- Press - Show the list of dashboards
- Drag the dashboard
Apollo Delivery Slots
- Name:
- Press
- Add context parameters to the action:
- Go into the Dashboard Rules for the action
- (You can leave the expression blank - a blank expression in a dashboard rule means that the dashboard will always be opened when the action is run)
- Got to the Context Parameters tab section
- Press
- Configure a context parameter with the settings:
- Name:
DeliveryZone
- Expression:
ApolloDeliveries.DeliveryZone
- (Note that to reference the selected row, we use the Element Name
- element nameof the view on the dashboard)
- Press
- Name:
- Configure another context parameter:
- Name:
RedeliveryDate
- Expression:
ApolloDeliveries.RedeliveryDate
- Press
- Name:
- Press in the main Action action configuration form
- To associate the action with the view:
- Open the configuration form for the view
Apollo Deliveries
- Go to the Menu
tab - Open the configuration form for the view
- Items section
- Press - Actions
- Select your action from the list and drag it into the list of actions associated with the view
- Press to apply your changes
You have configured the action Review Redelivery Slots
to pop up another dashboard when it runs - Apollo Delivery Slots
. Now you will add a filter to Apollo Delivery Slots
so that it only shows entries relevant for the customer's details (delivery zone and redelivery date):
- Open the view
Apollo Delivery Slots
from the Stream streamApollo Delivery Slots
(to see the data) - Add a filter:
- Name:
for Customer Details
- Conditions:
- Where ALL the following are true
DeliveryZone
equals_context.DeliveryZone
- Press the ABC button - this will now say fx
DeliverySlotDate equals _context.RedeliveryDate
- Press the ABC button - this will now say fx
- Press
- All records in the view will disappear – this is because there is currently no context set
- Name:
- Make this the default filter for the view:
- Open the configuration form for the view – remember that you can do this by right - clicking anywhere on any data record and selecting Show View (you will have to remove the filter you just added to do this)
- Go to the Advanced tab
- Set Default the view and going to Show the Stream View Configuration
- Set Background Filter to:
for Customer Details
- Press
Now test the new action:
- Open the dashboard
Apollo Manage Redeliveries
- Select a record with status
REQ REDELIVERY
and press theReview Redelivery Slots
button - The delivery slots dashboard will appear, with entries filtered for the selected customer's details
...
Note |
---|
If the delivery slots dashboard is empty - the most common reason is that the dashboard element name has not been correctly set on the view |
Validating actions
In this exercise you will add a validation step to the action you created in the previous exercise. There is no point in reviewing delivery slots for deliveries that have already been completed. So you will validate, when the user runs the action to show delivery slots, that the record is a redelivery request:
- Go to the Stream stream
Apollo Deliveries
- Open the configuration form for the action
Review Redelivery Slots
- Go to the Validate Action tabValidation section
- Enter Update the expression Validation Expression to:
Code Block |
---|
if (ApolloDeliveries.DeliveryStatus != "REQ REDELIVERY", error("Not a redelivery request") ) |
- Press
- Go into app mode
- Try running your action again – both on rows which are redelivery requests, and rows which are not - you should see the error appear when the row is not a redelivery request
...
Info |
---|
When are are developing application screens like this, it is often helpful to have one window open in design mode, and one in app mode. This is possible against a since instance of PhixFlow - in fact, you can do this in two tabs within the same browser, logged in as the same user. |
Add action to choose delivery slot
You will now add an action to the delivery slots dashboard to choose one of the suggested slots.
To start, you need to go to the Actions tab section of the stream Apollo Delivery Slots
. Note that you can do this from the dashboard:
- Open the dashboard
Apollo Delivery Slots
In - Right click anywhere on the view
Apollo Delivery Slots
, press Press - this opens the configuration of the stream behind the view and go toShow the Stream Configuration
- Go to the Actions tab section
- Add an action:
- Name:
Apollo Deliveries Choose Delivery Slot
- Display Name:
Choose Delivery Slot
- Go to the Item Updates tab Update StreamItems section
- Set Stream Item Action to Update
- Press
- Press and drag the attribute
RedeliveryRef
into the list of Action Attributes to Update
- Name:
You will update this attribute with the value of the redelivery reference in the original Apollo Manage Redeliveries
dashboard. First you need to add a context variable to hold this value on the original action:
- Go to the Stream stream
Apollo Deliveries
- Open the configuration form for the action
Review Redelivery Slots
- Add a context parameter:
- Name:
RedeliveryRef
- Expression:
ApolloDeliveries.RedeliveryRef
- Name:
- Save your changes to the action
- Return to the action
Apollo Deliveries Choose Delivery Slot
on the streamApollo Delivery Slots
- First you need to store the context parameter
RedeliveryRef
in a context parameter in the theApollo Deliveries Choose Delivery Slot
action; the context is re-set when you run a new action, so you need to capture this value to use in the Choose actionbefore the next step- Add a new context parameter:
- Name:
RedeliveryRefStored
- Expression:
_context.RedeliveryRef
- Name:
- Add a new context parameter:
- Complete configuration of the action attribute
RedeliveryRef
:- Open the configuration form for this attribute
- Set the Expression to:
_context. RedeliveryRefStored
- Save your changes to the action
- Add the new action to the view
Apollo Delivery Slots
- Make the new action a refresh action on the view
Apollo Delivery Slots
- Test your new action:
- Open the dashboard
Apollo Manage Redeliveries
- Choose a row where
DeliveryStatus
isREQ REDELIVERY
- Press
Review Redelivery Slots
- In the dashboard
Apollo Redelivery Slots
select a slot - Press
Choose Delivery Slot
- The
Redelivery Ref
from the original dashboard will be written to theRedelivery Ref
of the chosen slot
- Open the dashboard
- Finally, update the default filter on the view
Apollo Redelivery Slots
so that when theRedeliveryRef
field is populated it is not shown – in this way, once a slot has been chosen, it cannot be chosen again - Test your process again – this time, when you choose a slot it should disappear from the
Apollo Redelivery Slots
dashboard; to- To see the reference value you wrote to the slot, use the default view on the stream
Apollo Redelivery Slots
- To see the reference value you wrote to the slot, use the default view on the stream