Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Thursday, April 7, 2011

Passing values across pages using report navigation

Scenario - Navigate from Report A to Report B and Report B data should get filtered based on the selection made in Report A.
Solution -
Note -Report A and Report B should have some common tables and fields. Data filtering upon navigation will only happen on the common tables and columns.
Example 1 - We have a Order header report and want to navigate to Order details, where user will click on Order Number and will be navigated to a detail report with order line information. a. Create Report A with attributes Order Number from table1. b. Create Repprt B with attribute Order Number from table1 and line number from table2 and make a filter Order Number "is prompted" c. Modify Report A, add value level navigation in column order number to report B. d. Once you click on order number column in report A, it will open a new window with order and lines details for the order selected in Report A
Example 2 - Same two reports as mentioned in the above example. Navigation will be based on order number but the target report will be filtered for the customer of the order in Report A a. Create Report A with attributes order number and customer number rom table 1 b. Create Report B with attributes order number and customer number form table 1 and line number from table2 and make a filter customer number "is prompted" c. Modify report A, add value level naviation on column Order Number to report B d. Once you click on Order Number in Report A, it will open Report B where data might be filtered by the customer. Wierd! Right?
Answer is in the ordering of the columns in the report A. Note - All the columns in Report A, which are required to pass values to Report B, should be placed to the left of the column on which navaigation link will be placed.

Sunday, June 27, 2010

Passing report prompts to inline query in physical layer

Scenario - You have a query pasted in the RPD and there is a inline query in it, which needs to be filtered based on one of the prompt on the dashboard.

Solution -
Suppose you want to filter a column named status in your inline query. Now we create a session variable sStatus. Provide the following sql in the session variable select '@{status}' from dual; Where status in '@{status}' is your presentation variable. Provide a default initializer '@{status}'. Default initializer is required, this way your if you use it for adhoc reporting, the view wont error out becuase session variable is not containing any value definition. Now place this session variable in physical query (inline query) and use a decode statement e.g (decode (session_variable,'@{status}',status,session_variable). Status column in this decode is the status column from actual table. This is helpfull when you are not providing any value to the variable, the column will self join to itself and the report wont error out and the data will also be correct. Now in your report create a prompt and set a presentation varianble status. Now open the report, go to advance tab and in prefix mention following command set variable sSession = '@{status}'; What happens now is ..presentation variable is set first and the set variable command set the session variable. This all hapens before the execution of your query and the query data filters out based on the value you have selected from the prompt.