Scenario: Dashboard page displays last 7 days data dynamically, and also it will give controls to user can get what they need.
Here are the step by step to do that.
1. In Rpd navigate to Manage --> Variables-->Repository Initialization block.
2. Create an Initialization block with the name Currentdate
Write the following query in Default Initialization string.
select sysdate,sysdate-7 from dual;
3. Now click on Edit Data Target button, create server variables.
4. Test the results. Close the variable manager and save the Rpd.
5. Create a page level dashboard prompt.
This dashboard prompt contains 2 prompts of Hiredate column.
For both the columns in the formula tab enter the below formulas.
CASE WHEN 1=0 THEN EMP.HIREDATE ELSE TIMESTAMP '1900-01-01 00:00:00' END
CASE WHEN 1=0 THEN EMP.HIREDATE ELSE TIMESTAMP '2999-01-01 00:00:00' END
In the above case, HIREDATE is my date column, make the above prompts to set 2 presentation variables Startdate and Enddate.
Assign default value with the server variables.
Save this prompt.
6.Now go to Answers and start creating a report containing the required columns.
In Edit filter of HIREDATE column use the Between operator, use Startdate and Enddate presentation variables to filter the data.
7.Create a dashboard page with the above dashboard prompt and report.
Today Aug 21st 2011, now the report will put recent 7 days as (Aug 21st to Aug 14th) and if I access same report tomorrow, report will pull Aug 22nd to Aug 15th data as default, same time user provided with page prompt control to choose dates.
Here are the step by step to do that.
1. In Rpd navigate to Manage --> Variables-->Repository Initialization block.
2. Create an Initialization block with the name Currentdate
Write the following query in Default Initialization string.
select sysdate,sysdate-7 from dual;
3. Now click on Edit Data Target button, create server variables.
4. Test the results. Close the variable manager and save the Rpd.
5. Create a page level dashboard prompt.
This dashboard prompt contains 2 prompts of Hiredate column.
For both the columns in the formula tab enter the below formulas.
CASE WHEN 1=0 THEN EMP.HIREDATE ELSE TIMESTAMP '1900-01-01 00:00:00' END
CASE WHEN 1=0 THEN EMP.HIREDATE ELSE TIMESTAMP '2999-01-01 00:00:00' END
In the above case, HIREDATE is my date column, make the above prompts to set 2 presentation variables Startdate and Enddate.
Assign default value with the server variables.
Save this prompt.
6.Now go to Answers and start creating a report containing the required columns.
In Edit filter of HIREDATE column use the Between operator, use Startdate and Enddate presentation variables to filter the data.
7.Create a dashboard page with the above dashboard prompt and report.
Today Aug 21st 2011, now the report will put recent 7 days as (Aug 21st to Aug 14th) and if I access same report tomorrow, report will pull Aug 22nd to Aug 15th data as default, same time user provided with page prompt control to choose dates.