12 - Select Actions
Last updated 16/12/2025
This documentation will explain how you can use Five's
Five's
To do this the following steps are performed:
- Add the StocksInSector query to filter the stock belonging to each sector
- Add the Stocks In Sector data view to display the results from the StocksInSector query
- Add the ClickSector()function which uses Five'sselectAction()function
- Attach the ClickSector()function to the On Click event for the Investment by Sector chart area dataset
- Add the PreviousAction()function which uses Five'spreviousAction()function to return to the chart
- Add the Back To Chart action button on the Stocks In Sector data view and attach the PreviousAction()function to the On Press event to return to us to the previous action when clicked
Add the StocksInSector Query
The StocksInSector query's
The

2. Click the Add Item button and type StocksInSector in the Data Source ID field.
3. Click in the Query field to open Five's Query Builder.

4. Click the SQL tab.

5. Click the Copy button for the syntax below.
SELECT
Stock.StockCode,
Stock.Name
FROM
Stock
INNER JOIN Sector ON Stock.SectorKey = Sector.SectorKey
WHERE
Sector.Name = ?
6. Paste the syntax in the SQL Editor.
7. Click the Save button in the SQL Editor app bar.

8. Click the Parameters tab.

9. Click the Add Parameters button.

10. Type Sector in the Parameter ID field.
11. Type

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

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

Add the Stocks in Sector Data View
The StocksInSector query will be used as the data source for the Stocks in Sector data view.
1. Click Visual in the menu followed by Data Views in the sub-menu.
2. Click the Add Item button and type Stocks in Sector in the Title field.
3. Select StocksInSector (Query) in the Data Source field.

4. Click the Data Fields tab.

5. Select the Stock.StockCode record.

6. Either click the Edit button in the form app bar or click directly in the Caption field.
7. Click the Cancel button in the Caption field and type Stock Code.
8. Click the Save button in the form app bar.

9. Select the Stock.Name record.

10. Either click the Edit button in the form app bar or click directly in the Caption field.
11. Click the Cancel button in the Caption field and type Name.
12. Click the Save button in the form app bar.

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

Add the ClickSector Function
When in Five's Code Editor you will be interacting with Five's API. In the

2. Click the Add New Code button.

3. Type ClickSector in the Function ID field.
4. Select TypeScript in the Language field and click the OKAY button.

5. Click the Copy button on the code block below.
function ClickSector(five: Five, context: any, result: FiveError) : FiveError {
five.setVariable('Sector', context.xValue);
five.selectAction('StocksinSector');
return five.success(result);
}
6. Paste the code block over the template in the Code Editor and click the Save Current Tab button.

Attach the ClickSector Function
The Investment Analysis chart record has two chart area datasets. We need to attach the

2. Select the Investment Analysis record in the list and click the Datasets tab.

3. Select the InvestmentBySector (Query) record.

4. Click the Chart Area Datasets tab.

5. Select the Investment By Sector record.

6. Click the Events tab.

7. Either click the Edit button in the form app bar or click directly in the On Click field.
8. Select ClickSector in the On Click field.

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

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

Add the PreviousAction Function
When in Five's Code Editor you will be interacting with Five's API. In the

2. Click the Add New Code button.

3. Type PreviousAction in the Function ID field.
4. Select TypeScript in the Language field and click the OKAY button.

5. Click the Copy button on the code block below.
function PreviousAction(five: Five, context: any, result: FiveError) : FiveError {
five.previousAction();
return five.success(result);
}
6. Paste the code block over the template in the Code Editor and click the Save Current Tab button.

Add the Back To Chart Action Button
The Stocks in Sector data view needs an action button with the

2. Select the Stocks in Sector record in the list and click the Action Buttons tab.

3. Click the Add Action Buttons button.

4. Type Back To Chart in the Caption field.
5. Click the Events tab.

6. Select PreviousAction in the On Press field.

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

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

Test the Action Functions
1. Select the Growth Portfolio record in the list and click the Down button in the form app bar.
2. Click a slice of the pie in the Investment By Sector chart.


3. Click the Back To Chart button.

