Friday, August 14, 2009

Dashboard URL navigation from source to target dashboard page and unicode replacement

This post is translated from Croatian, from one of my previous posts. For navigation between reports we use GO URL, but for navigation between dashboard pages we use DASHBOARD URL. Basic documentation about this can be found in the presentation services administration guide http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/b31766.pdf on the page 210 (referencing dashboard content in external portals or applications using
the oracle BI presentation services DASHBOARD URL. I'll not explain basic syntax how to use DASHBOARD URL. This can be found in documentation or other blogs.

Example (with unicode replacement):

I will explain dashboard url navigation between two pages on the same dashboard. Dashboard pages, columns, etc, are based on Croatian terminology, so I will try to translate it, although it's not so important, the technique is.

So, there are two dashboard pages on Development dashboard, revenues, which give us some measure for products from the fact table and the second is šifarnik proizvoda which give us some detailed information about products, in this case only product group is shown in the detail part.



I'll explain reports on each dashboard pages later.

The basic idea on the first page is that the user enters some value on the dashboard prompt field and we need to give a possibility to enter the code or the product name. Also, the user want to use LIKE condition it the report.

This is the dashboard prompt in the first page (the name of the field is 5):



We set here presentation variable v_ulaz_var. This is very important to set. We'll use it later in te second report in the second dashboard page to remember what user enters in this prompt when we return back from the second report on the second dashboard page to this one (first report on the first dashboard page). We want to return value that user enters, not reseting it.

Abbreviations:

The first report on the first dahboard page -> FRFDP
The second report on the second dashboard page -> SRSDP


The first report on the first dashboard page (FRFDP):



The first two columns are product name and the code, the third one is the measure and the last one is important for DASHBOARD URL navigation.

Note that we enter manually filter for LIKE condition in case that the user enters product name or the product code.

Now, here is our next step. We want to go to the another report (SRSDP) and parse the product code from the current row column from FRFDP, and the result will be detailed information for that product (product code).

But we need one more thing here. We want to parse the value that we set in the v_ulaz_var, which in presentation variable that we set in the first page. And we want to show it in the second report (SRSDP). So for this case we will do some tricks.

In the second dashboard page we make a dummy dashboard prompt first:



Inside it we can parse what ever we want to from the first dashboard page (current row column report values, constants, presentation variables from dashboard prompts from the first page, etc). In every field we set new presentation variables that we can use in the SRSDP. So, this is a trick that works here. And in any case we can return any value to dashboard prompts on the first page.

Note that when using DASHBOARD URL you are parsing value to a dashboard prompt fields and the GO button is automatically executed and you get the report. So beware what you are putting on your dashboard page.

Here are fields and presentation variables on dummy dashboard prompt:

Field 1, presentation variable v_var1 -> we'll parse current row product code (šifra proizvoda) value from the FRFDP inside it.

Field 2, presentation variable v_var2 -> we'll parse harcoded string 'Dva' inside it.

Field 3, presentation variable v_var3 -> we'll parse harcoded string 'Tri' inside it.

Field 4, presentation variable v_var4 -> we'll parse v_ulaz_var presentation variable from the dashboard prompt from the first dashboard page inside it.

The second report on the second dashboard page (SRSDP):



The first two columns are product name and the code and the third is product group.

In the column four (Varijable) we concatenate all presentation variable from the dummy dashboard prompt, to see if our navigation works fine and if all parameters are successfully transferred:



The last column (Povratak) we'll explain later, because it's a part of DASHBOARD URL for returning back to the previous dashboard page and return v_var4 into v_ulaz_var.

In this report we have a filter that is important, because we are parsing product code (Šifra proizvoda) from FRFDP to SRSDP. We are using v_var1 presentation variable in which we parse product code before:



Now, let's go to FRFDP. There is a column Go dashboard navigation in which we'll place DASHBOARD URL code to call a second dashboard page and parse parameters to a dummy dashboard prompt and according to that implicitly call the second report on the second dashboard page (SRSDP).

Column GO dashboard navigation on FRFDP:



Basic explanation:

PortalPath=/shared/Development/_portal/Development/&Page=%u0160ifarnik%20proizvoda

%u0160 and %20 is required because of unicode translation (Šifarnik proizvoda).

Col1=1 -> target field on the dummy dashboard prompt on the second page is 1.
Val1=... -> source field from FRFDP.

In the field 1 in the dummy dashboard prompt we are parsing product code (Šifra proizvoda).

If the product code (šifra proizvoda) has spaces inside the data (for example, PR 01), we need to replace space ' ' first with a plus sign '+' and then the plus sign '+' replace with ASCII 2B.

Now, let's go to again to SRSDP. There is a column Povratak in which we'll place DASHBOARD URL code to return back to the previous page without reseting dashboard prompt from it, so basicly we are returning parameter from the presentation variable v_var into field 5 in the first page dashboard prompt. In case that we don't do that, when returning back with DASHBOARD URL to first page we would get all rows in the FRFDP, and we don't want that, we want to apply what we have in the prompt in the previous state.

Column Povratak on SRSDP:



Col1=5 -> target field on the first page dashboard prompt is 5.
Val1=v_var4 -> the source parameter is the presentation variable v_var4 that we set in the second page dummy prompt.

Finally, this is complete view, with both dashboard pages and sections inside them:





Note that in the second page we put dummy dashboard prompt on the separate section.

Test

At initial, the user place the value in the first page prompt and according to that we receive the result on the first page report. We don't know whether the user enters all product code or product name or just few strings (LIKE condition), both conditions are supported in the report filter. We press GO button and get the data:



We see that the product name LIKE condition (Naziv proizvoda LIKE 'Trk%') is satisfied and we receive one row in the result of the first report.

Also in the current row of the report we know the product code (Šifra proizvoda) which is hidden column (the value is PR-01, we don't see it).

With the column GO dashboard navigation we are going to second page and forwarding already mentioned parameters.

The result is the second page with the second report:



Note that all parameters are forwarded correctly and we get the desired data in the report.

We can hide dummy dashboard prompt with guided navigation applied on the section:



For guided navigation we use dummy report that always shows the data, so the section is always hidden in that case:



Now, we don't see dummy prompt:



After we press column Povratak (string Povratak na prvi page) we are going to the fist page without reseting filter to the first report, this is previous state:



Conclusion

This is the way and example that we can parse presentation variable from the first report to the second. Each report has its own page and its own dashboard prompt. We can hide the second page and when we call it from the DASHBOARD URL on the first page report it's look like we are calling a new report, the only difference brtween GO URL (which is only for reports) and this one is that we can parse real presentation variable to the target dashboard prompt on the target page and use it in the target report which is paced in the target page.

Tuesday, August 11, 2009

Dynamic dashboard prompts and columns used in multifunctional report, full guided navigation

Example:

Three dashboard prompts. One is showing only days or months selection and after pressing GO button we are showing second section with day values in dashboard prompt or third section with month values in dashboard prompt. The second and third sections are guided navigated and we only show one section depends on what user selects from the first dashboard prompt (first section), days or months. After we select value from the second dashboard prompt we get our report. The report is only one, with dynamic column in the group by part, depends on what user selects. For this example I used guided navigation applied on sections. I'll explain it in detail.

The first dashboard prompt applied on the first section:



Show/SQL Results:

SELECT case when 1=2 then TIMES.CALENDAR_MONTH_DESC
else 'Day'
end FROM "Normal model"
union all
SELECT case when 1=2 then TIMES.CALENDAR_MONTH_DESC
else 'Month'
end FROM "Normal model"

First section:



Dashboard prompt applied on the second section:



Column formula for date from:

case when 1=2 then TIMES.TIME_ID else cast ('1.1.1900' as date) end

Column formula for date to:

case when 1=2 then TIMES.TIME_ID else cast ('1.1.1901' as date) end

Second section:



Guided navigation report applied on the second section:



Column formula for pv_dyn_group_by column (we can delete it after we make filter):

'@{pv_dyn_group_by}'

The report will show data if the presentation variable from the first section (first dashboard prompt) pv_dyn_group_by is filled with Day harcoded value. So the second section is whowed only in this condition. TIMES.CALENDAR_YEAR is dummy column.

Dashboard prompt applied on the third section:



Third section:



Guided navigation report applied on the third section:



Column formula for pv_dyn_group_by column (we can delete it after we make filter):

'@{pv_dyn_group_by}'

The report will show data if the presentation variable from the first section (first dashboard prompt) pv_dyn_group_by is filled with Month harcoded value. So the second section is whowed only in this condition. TIMES.CALENDAR_YEAR is dummy column.

Target report and the section four:



Column formula for dynamic group by column:



Must be same datatypes inside it.

Filter (advanced, convert this filter to SQL option):



Section four:



Guided navigation report applied on the section four:



We need this guided navigation report that we applied on the section four because at initial we don't want to show target report, we show it only when one of the value of the presentation variable pv_dyn_group_by is selected, and that is Day or Month value, from the first dashboard prompt from the first section.

Filter (advanced, convert this filter to SQL option):



We applied guided navigation reports in the properties of the section, we do the same for the second and the third section (explained before):



Finally, this is complete view, with all sections:



Now, we are going to test this solution.

Test

Initial:



Select Day and press the first GO button:



Dashboard prompt with dates is shown:



Choose date from and to values and press the second GO button:



Target report for this case:



Now, change the value to Month and press the first GO button again:



Dashboard prompt with months is shown:



Choose month from and to values and press the second GO button:



Target report for this case:

Sunday, August 9, 2009

GO URL request navigation and unicode replacement

This post is translated from Croatian, from one of my previous posts. There are many sources of information and questions on OTN forum on how to use GO URL in OBIEE like this one http://forums.oracle.com/forums/thread.jspa?messageID=3595832 and the basic documentation about this can be found in the presentation services administration guide http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/b31766.pdf. I will not explain here what is the basic syntax. I'll explain how to replace some characters with unicode codes.

There is a two different type of navigation to a new request. One is option value interaction = navigate, on the column properties:




The second, advanced option is to using GO URL.

If we have characters in the column names in the presentation area that are not standard in the ASCII (they are non-ASCII strings) (see http://www.asciitable.com/) for them we used corresponding UNICODE conversion http://rishida.net/scripts/uniview/conversion, for example Croatian character š is non-ASCII string and has to be replaced with UNICODE.

In our case we are using one report to another combination and parsing current row column value from the source report to the target report filter.

We can use Oracle database functions for ASCII and UNICODE codes:

select dump('š', 1016) from dual--hexadecimal: c5a1
select ASCIISTR('š') from dual--unicode: \0161
select to_number('c5a1', 'XXXX') from dual--hexadecimal to decimal: 50593
select chr(50593) from dual--decimal to ascii: š


The source report:



The target report:



GO URL on the source report:



This is required to set before:



P2 is the target request column and P3 is the source request column.

P2 (target) -> Proizvod."%u0160ifra%20proizvoda
P3 (source) -> REPLACE(Proizvod."Šifra proizvoda", ' ', '%20')


*Note that Š is replaced with %u0160 unicode and space with %20 only in the target column. This is related only to a presentation column name. For the source column name we leaved Š and spaces (Proizvod."Šifra proizvoda") and replace space in data inside it (with %20).

Inside P3 (source) it's necessary to replace space with %20, because if there is a space in the data (for example PR 0107) without replacing it with corresponding UNICOD or hexadecimal codes we woudle get only first string (PR) and the second (0107) is cutted.

For example, for spaces we use:

select dump(' ', 1016) from dual--hexadecimal: 20

or


http://rishida.net/scripts/uniview/conversion

If we notice that some of characters are not properly transferred we need to replace them all as well, for example > character should be replaced with REPLACE(Proizvod."Šifra proizvoda", '>', '%3E'), because:

select dump('>', 1016) from dual--hexadecimal: 3e

P3 (source) can be any presentation column, constant, session or repository variable. In our example it is presentation column Proizvod.Šifra proizvoda.

Now if we use for example static repository variable P3 -> VALUEOF("v_sifra") as a source parameter from the source report instead of presentation column we would have GO URL like this:

Friday, August 7, 2009

Joining two fact tables with different dimensions into single logical table

Often question on OTN forum is that if we have two fact tables and they are sharing some dimensions and some dimensions are not shared how we can show data for all dimensions. For example if we have F1 (D1, D2 and D3), and F2 (D1 and D2 and D4) and user choose F1 F2 D1 D2 D3 D4 he need to get data for F1 that matchs only for D1-D2-D3 and data for F2 that matchs only D1-D2-D4, all that in one row, so D3 and D4 are not common dimensions.

How we can achieve this in BMM model in one logical fact table?

Fist, we make in our repository table SALES_TIME_CHANNELS that has only TIMES and CHANNELS dimensions and SALES that has only PRODUCTS and TIMES. So, the only common dimension here is TIMES.

Physical diagram:



Source select for SALES_TIME_CHANNELS:

select (amount_sold-100) as amount1, time_id, channel_id from sales

BMM:



We make complex joins for all dimensions to our fact LT:



It is required to create dimensions for all dimension tables. Not that we have two logical table sources for SALES fact logical table. As we have 2 measure (one from SALES table, second from SALES_TIME_CHANNELS table) we need to specify aggregation level for those measures because they are not sharing some dimensions.

Go first to QUANTITY_SOLD and put total logical level for ChannelsDim dimension. With this we exclude channels dimension for SALES table in the GROUP BY part because SALES is only aggregated by TIME and PRODUCTS dimension:



The similar we do for amount1 column:



Test in Answers:



We can see that measure amount1 is aggregated only by CALENDAR_YEAR and CHANNEL_CLASS and measure QUANTITY_SOLD is aggregated only by PROD_CATEGORY and CALENDAR_YEAR:



NQQuery.log (OBIEE server generates 2 separate queries):