Skip to main content

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
Custom Actions are not supported as an action page.

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.
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.


Queries Menu Item
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.


Add the SellAllocations Query
Figure 2 - Add the SellAllocations query

4. Click the SQL tab.


SQL Tab
Figure 3 - SQL tab

5. Click the Copy button for the below syntax.

MySQL
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.


Save Button
Figure 4 - Save button

8. Click the Fields tab.


Fields Tab
Figure 5 - Fields tab

9. Select the TransactionDate record.


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.


Edit the TransactionDate Field
Figure 7 - Edit the TransactionDate field

15. Click the Save button in the form app bar.


Save Button
Figure 8 - Save button

16. Select the Quantity record.


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.


Edit the Quantity Field
Figure 10 - Edit the Quantity record

21. Click the Save button in the form app bar.


Save Button
Figure 11 - Save button

22. Select the SellQuantity record.


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.


Edit the SellQuantity Record
Figure 13 - Edit the SellQuantity record

28. Click the Save button in the form app bar.


Save Button
Figure 14 - Save button

29. Click the Parameters tab.


Parameters Tab
Figure 15 - Parameters tab

30. Click the Add Parameters button.


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.



Add the BuyKey Parameter
Figure 17 - Add the BuyKey parameter

33. Click the Save button in the form app bar.


Save Button
Figure 18 - Save button

34. Click the Save button in the form app bar above the list.


Save Button
Figure 19 - Save button
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.


Data Views Menu Item
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).


Add the Sell Allocations Data View
Figure 21 - Add the Sell Allocations data view

4. Click the Data Fields tab.


Data Fields Tab
Figure 22 - Data Fields tab

5. Select the TransactionDate record.


Transaction Date 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.

Edit Transaction Date Field
Figure 24 - Edit Transaction Date field

8. Click the Save button in the form app bar.


Save Button
Figure 25 - Save button

9. Select the Quantity record.


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.


Edit the Quantity field
Figure 27 - Edit the Quantity field

12. Click the Save button in the form app bar.


Save Button
Figure 28 - Save button

13. Select the SellQuantity record.


Sell Quantity 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.


Edit the Sell Quantity Record
Figure 30 - Edit the Sell Quantity record

16. Click the Save button in the form app bar.


Save Button
Figure 31 - Save button

17. Select the BuyKey record.


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.



Edit the BuyKey Record
Figure 33 - Edit the BuyKey record

20. Click the Save button in the form app bar.


Save Button
Figure 34 - Save button

21. Click the Save button in the form app bar above the list.


Save Button
Figure 35 - Save button
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.


Forms Menu Item
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.


Pages tab
Figure 37 - Pages tab

3. Click the Add Pages button.


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).


Add the Sell Allocations Page
Figure 39 - Add the Sell Allocations page

7. Click the Save button in the form app bar.


Save Button
Figure 40 - Save button

8. Click the Save button in the form app bar above the list.


Save Button
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.


Run Button
Figure 42 - Run button

2. Select the Growth Portfolio record.

3. Click the Down button in the form app bar.


Down Button
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.


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.

Sell Allocations Page
Figure 45 - Sell Allocations page

4. Close the browser tab.