11 - Add an Action Page
Last updated 3/01/2023
This documentation is to demonstrate how you can create an action page on a form. Five has the following actions:- Charts
- Custom Actions
- Forms
- Data Views
- Dashboards
- Mail Merges
- Processes
- Reports
We are going to add a data view that will display shares that we have sold. This data view will then become a page on the Buys form so we can have a report for the stock that has been sold without having to leave the Buys form.
Navigate to Queries
info
A query needs to be added that will return the results of our sold shares.
1. Click Data in the menu.
2. Click Queries in the sub-menu.
Figure 1 - Queries menu item
Add the SellAllocations Query
1. Click the Add Item button.2. Type SellAllocations in the Data Source ID field.
3. Click in the Query field to open Five's Query Builder.
Figure 2 - Add the SellAllocations query
4. Click the SQL tab.
Figure 3 - SQL tab
5. Click the Copy button for the below syntax.
SellAllocations
SELECT
TransactionDate,
Allocation.Quantity AS Quantity,
Sell.Quantity AS SellQuantity,
Allocation.BuyKey AS BuyKey
FROM
Allocation
INNER JOIN Sell ON Allocation.SellKey = Sell.SellKey
HAVING
(BuyKey = ?)
ORDER BY
TransactionDate
6. Paste the syntax in the SQL Editor.
7. Click the Save button in the SQL Editor app bar.
Figure 4 - Save button
8. Click the Fields tab.
Figure 5 - Fields tab
9. Select the TransactionDate record.
Figure 6 - TransactionDate record
10. Either click the Edit button in the form app bar, or click directly in the Data Type field.
11. Click the lookup icon in the Data Type field and select Date.
12. Type 8 in the Size field.
13. Add a space between Transaction and Date in the Default Caption field.
14. Click the lookup icon in the Default Display Type field and select _Date.
Figure 7 - Edit the TransactionDate field
15. Click the Save button in the form app bar.
Figure 8 - Save button
16. Select the Quantity record.
Figure 9 - Quantity record
17. Either click the Edit button in the form app bar, or click directly in the Data Type field.
18. Click the lookup icon in the Data Type field and select Integer.
19. Type 4 in the Size field.
20. Click the lookup icon in the Default Display Type field and select _Integer.
Figure 10 - Edit the Quantity record
21. Click the Save button in the form app bar.
Figure 11 - Save button
22. Select the SellQuantity record.
Figure 12 - SellQuantity record
23. Either click the Edit button in the form app bar, or click directly in the Data Type field.
24. Click the lookup icon in the Data Type field and select Integer.
25. Type 4 in the Size field.
26. Add a space between Sell and Quantity in the Default Caption field.
27. Click the lookup icon in the Default Display Type field and select _Integer.
Figure 13 - Edit the SellQuantity record
28. Click the Save button in the form app bar.
Figure 14 - Save button
29. Click the Parameters tab.
Figure 15 - Parameters tab
30. Click the Add Parameters button.
Figure 16 - Add Parameters button
31. Type BuyKey in the Parameter ID field.
32. Type
{{five.stack.Buy.BuyKey}}
in the Parameter field.
Figure 17 - Add the BuyKey parameter
33. Click the Save button in the form app bar.
Figure 18 - Save button
34. Click the Save button in the form app bar above the list.
Figure 19 - Save button
Navigate to Data Views
info
The Sell Allocations data view needs to be created using the SellAllocations query to display the results on the Buys form.
1. Click Visual in the menu.
2. Click Data Views in the sub-menu.
Figure 20 - Data Views menu item
Add the Sell Allocations Data View
1. Click the Add Item button.2. Type Sell Allocations in the Title field.
3. Click the lookup icon in the Data Source field and select SellAllocations (Query).
Figure 21 - Add the Sell Allocations data view
4. Click the Data Fields tab.
Figure 22 - Data Fields tab
5. Select the TransactionDate record.
Figure 23 - Transaction Date record
6. Either click the Edit button in the form app bar, or click directly in the Width field.
7. Click the Cancel button in the Width field and type 20.
info
The Width field defines the length of the field on the data view.
Figure 24 - Edit Transaction Date field
8. Click the Save button in the form app bar.
Figure 25 - Save button
9. Select the Quantity record.
Figure 26 - Quantity record
10. Either click the Edit button in the form app bar, or click directly in the Width field.
11. Click the Cancel button in the Width field and type 20.
Figure 27 - Edit the Quantity field
12. Click the Save button in the form app bar.
Figure 28 - Save button
13. Select the SellQuantity record.
Figure 29 - Sell Quantity record
14. Either click the Edit button in the form app bar, or click directly in the Width field.
15. Click the Cancel button in the Width field and type 20.
Figure 30 - Edit the Sell Quantity record
16. Click the Save button in the form app bar.
Figure 31 - Save button
17. Select the BuyKey record.
Figure 32 - BuyKey record
18. Either click the Edit button in the form app bar, or click directly in the Show If field.
19. Type
false
in the Show If field.
Figure 33 - Edit the BuyKey record
20. Click the Save button in the form app bar.
Figure 34 - Save button
21. Click the Save button in the form app bar above the list.
Figure 35 - Save button
Navigate to Forms
info
The Buys form needs to be edited to add the Sell Allocations data view as an action page.
1. Click Visual in the menu.
2. Click Forms in the sub-menu.
Figure 36 - Forms menu item
Add the Sell Allocations Page to the Buys Form
1. Select the Buys record in the list.2. Click the Pages tab.
Figure 37 - Pages tab
3. Click the Add Pages button.
Figure 38 - Add Pages button
4. Type Sell Allocations in the Caption field.
5. Click the lookup icon in the Page Type field and select Action.
6. Click the lookup icon in the Action field and select SellAllocations (Data View).
Figure 39 - Add the Sell Allocations page
7. Click the Save button in the form app bar.
Figure 40 - Save button
8. Click the Save button in the form app bar above the list.
Figure 41 - Save button
Run the Portfolio Application
tip
This is a good time to run the Portfolio application and see the Sell Allocations page!
1. Click the Run button in Five's toolbar.
Figure 42 - Run button
2. Select the Growth Portfolio record.
3. Click the Down button in the form app bar.
Figure 43 - Down button
Test the Buys Form
1. Select Buys in the menu.2. Select the NAB 2023-12-13 record in the list.
3. Click the Sell Allocations tab.
Figure 44 - Sell Allocations tab
info
We can see 1100 NAB shares were sold and 1000 of them came from this purchase date.
Figure 45 - Sell Allocations page
4. Close the browser tab.