In this post we will see how we can get the count of values selected in OBIEE dahboard prompt.
For instance , we have prompt where it will list out all the month names,now if you want to do the calculation based on number of selected months (like calculating avg sales based on number of months selected),then this logic will be most help full.
Lets assume we have a dashboard prompt which had list of values like JAN-15,FEB-15,MAR-15,APR-15,MAY-15 etc.
if you select first 3 months in the prompt then OBIEE presentation variable passes the multiple selected values as comma separated string like JAN-15,FEB-15,MAR-15 as shown below.
Here 3 values selected an those 3 are separated by 2 commas .
For instance , we have prompt where it will list out all the month names,now if you want to do the calculation based on number of selected months (like calculating avg sales based on number of months selected),then this logic will be most help full.
Lets assume we have a dashboard prompt which had list of values like JAN-15,FEB-15,MAR-15,APR-15,MAY-15 etc.
if you select first 3 months in the prompt then OBIEE presentation variable passes the multiple selected values as comma separated string like JAN-15,FEB-15,MAR-15 as shown below.
Here 3 values selected an those 3 are separated by 2 commas .
So basic idea is finding number of comma(,)s
occurrences in the input obiee prompt string and add 1 to it get total number
of selected values.
Here is sample sql
select (length('JAN-15,FEB-15,MAR-15') - length(replace('JAN-15,FEB-15,MAR-15', ',','')))+1 from dual;
which is length(whole
string)-length(whole string without commas)+1 will give the number of
values separated by comma.
Same logic can be implemented in OBIEE
with below formula in answers.
CHAR_LENGTH('@{PeriodCount}')
-CHAR_LENGTH(REPLACE('@{PeriodCount}', ',',''))+1
Here @{PeriodCount} is
presentation variable which is assigned to Fiscal Period Prompt
No comments:
Post a Comment