Set Token Value By Script
This applies to: Managed Dashboards, Managed Reports
This article walks through how to set a token value using script. In the example below, the filter value is set to All when a button is clicked. See Set Filter Value By Script for the steps for setting up the dashboard and filter used in this example.
While script is not required to accomplish an interaction like this, the purpose of this article is to demonstrate how you can perform this action using the API as part of your own custom functionality.
Script Library sample: Set range number parameter token
Check applicable token values
You can view the dashboard and check the applicable token values. In this case, All and Default.
Add the Script
Add the script to the button's Click actions.
Here is a list of tokens with predefined IDsyou can use as done above. Note that not all are applicable for the member filter used in this sample. Any token can be used once you find its ID - see Modify a Filter / View Parameter Using Scripting for more details and examples.
ALL_TOKEN_DEFINITION_ID: "All"DEFAULT_TOKEN_DEFINITION_ID: "Default"NULL_TOKEN_DEFINITION_ID: "Null" (only if your filter allows null)NO_SELECTION_TOKEN_DEFINITION_ID: "No Selection"OPEN_RANGE_BOUNDARY_TOKEN_DEFINITION_ID: "Open Range" (normally used for date filters)
Tip
The ID of any token can found from the Tokens screen in Administration by selecting one and clicking Details in the toolbar.
Test the Script
Choose Sandbox View in the toolbar to test the dashboard without saving changes made while viewing.
Select any filter specific value.
Click the button.
Result: The new filter value should be set to "All".
For more information, see:
Comments
0 comments
Please sign in to leave a comment.