Defining dynamic default values for prompts
Suppose that we have a report which allows users to select a shipment month. In our data warehouse, the Time dimension (for shipment month) contains values up to the current month. However, the business owners frequently select the prior month, so they want the prompt to have the prior month selected by default.
Getting ready
Create a report that filters on the Shipment Month Key. Create a prompt page and add a value prompt for the Shipment Month Key.
How to do it...
To achieve the requirements of the business owner, we will write a JavaScript code that selects the second value from the top by default. In order to do this, perform the following steps:
Open the prompt page in the report and select the value prompt. Adjust the sorting property such that the Shipment Month Keys are populated in the descending order.
Let's start by adding an HTML item before the Shipment Month value prompt. The HTML should be
<span id = 'A1'>
.Now add another HTML item...