11 - Add an Action Page
Last updated 5/04/2023
This documentation is to demonstrate how you can create an action page on a form. Five has the following actions:- Forms
- Charts
- Queries
- Dashboards
- Mail Merges
- Processes
We are going to add a query that will return stocks that we have allocated for a sale. This query will then be referenced 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
1. Select Visual in the menu.2. Select Queries in the sub-menu.
Figure 1 - Queries menu item
Add the Sell Allocations Query
1. Click the Add Item button.2. Type Sell Allocations in the Title field.
3. Click in the Query field to open Five's Query Builder.
Figure 2 - Add the Sell Allocations query
4. Click the SQL tab.
Figure 3 - SQL tab
5. Click the Copy button for the below syntax.
Investment by Sector
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 the Sell Allocations syntax
8. Click the Fields tab.
Figure 5 - Fields tab
9. Select the TransactionDate record.
Figure 6 - TransactionDate record
10. Click in the Caption field and add a space between Transaction and Date.
11. Click the lookup icon in the Display Type field and select _Date.
12. Click the Save button in the form app bar.
Figure 7 - Edit the TransactionDate record
13. Select the Quantity record.
Figure 8 - Quantity record
14. Click the lookup icon in the Display Type field and select _Integer.
15. Click the Save button in the form app bar.
Figure 9 - Edit the Quantity record
16. Select the SellQuantity record.
Figure 10 - SellQuantity record
17. Click in the Caption field and add a space between Sell and Quantity.
18. Click the lookup icon in the Display Type field and select _Integer.
19. Click the Save button in the form app bar.
Figure 11 - Edit the SellQuantity record
20. Select the BuyKey record.
Figure 12 - BuyKey record
21. Type false in the Show If field.
22. Click the Save button in the form app bar.
Figure 13 - Edit the BuyKey record
23. Click the Parameters tab.
Figure 14 - Parameters tab
24. Click the Add Parameters button.
Figure 15 - Add Parameters button
25. Type BuyKey in the Parameter ID field.
26. Type {{five.stack.Buy.BuyKey}} in the Parameter field.
Figure 16 - Add the BuyKey parameter
27. Click the Save button in the form app bar.
Figure 17 - Save the BuyKey parameter
28. Click the Save button in the form app bar above the list.
Figure 18 - Save the Sell Allocations query
Create the Sell Allocations Page on the Buys Form
1. Select Visual in the menu.2. Select Forms in the menu.
Figure 19 - Forms menu item
3. Select the Buys record in the list.
4. Click the Pages tab.
Figure 20 - Pages tab
5. Click the Add Pages button.
Figure 21 - Add Pages button
6. Type Sell Allocations in the Caption field.
7. Click the lookup icon in the Page Type field and select Action.
8. Click the lookup icon in the Action field and select SellAllocations (Query).
Figure 22 - Add the Sell Allocations page
9. Click the Save button in the form app bar.
Figure 23 - Save the Sell Allocations page
10. Click the Save button in the form app bar above the list.
Figure 24 - Save the Buys form
Run the Portfolio Application
1. Click the Run button in Five's toolbar.Figure 25 - Run button
2. Select the Growth Portfolio record.
3. Click the Down button in the form app bar.
Figure 26 - Down button
Test the Buys Form
1. Select Buys in the menu.2. Select the first AEI record in the list.
3. Click the Sell Allocations tab.
Figure 27 - Sell Allocations tab
info
We can see 1100 AEI shares were sold and 1000 of them came from this purchase date.
Figure 28 - Sell Allocations page
4. Close the browser tab.