COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: karan27 on 27 Apr 2015 04:00:09 AM

Title: Render Variable without using Boolean Varible
Post by: karan27 on 27 Apr 2015 04:00:09 AM
 Prompt Page

  O   ENAME
  O   JOB
  O   SAL
  O   HIREDATE


     [Finish]

On the Report page Following are mandatory columns.

EMPNO DEPTNO
9090       30
7369       20
7499       30
7521       30
7566       20
7654       30
7782       10 

Now I have created STRING VARIABLE with following condition,

if  (ParamValue('Parameter1') contains ('ENAME')) then ('ENAME') else

if  (ParamValue('Parameter1') contains ('JOB')) then ('JOB') else

if  (ParamValue('Parameter1') contains ('SAL')) then ('SAL') else

if  (ParamValue('Parameter1') contains ('HIREDATE')) then ('HIREDATE')

With this condition when I am selecting single value i.e('ENAME' OR 'JOB' OR 'SAL' OR 'HIREDTAE') from prompt page then I am getting proper output.

But when I am selecting multiple values together i.e('EMANE' AND 'JOB' AND 'SAL') then output showing only ENAME with mandatory columns i.e('EMPNO' and 'DEPTNO')

The problem is when I am selecting multiple values that time first IF condition is execute and satisfy so it is not executing rest ELSE and IF part.

is there any way to execute remaining else part as wel

Thanks in Advance....

Title: Re: Render Variable without using Boolean Varible
Post by: schrotty on 27 Apr 2015 04:58:48 AM
Hello again,

why won't you use one single boolean variable for each from your multi-select-prompt?

The "case when"- and "if elseif"-structures breaks allways when a match is found.

Title: Re: Render Variable without using Boolean Varible
Post by: karan27 on 27 Apr 2015 06:46:27 AM
Schrotty, Thanks again for your reply.

Yes, we can achieve the output using Boolean variable for each.

but the task given to me is achieve output without using Boolean variable.
Title: Re: Render Variable without using Boolean Varible
Post by: schrotty on 27 Apr 2015 07:26:21 AM
Hi,

i consider the only way to solve this problem with a string variable is to set foreach possible combination of your choices set an other value:

eg.
CASE
WHEN ParamValue('Parameter1') = 'ENAME' THEN 'ENAME'
WHEN ParamValue('Parameter1') = 'ENAME ,JOB' THEN 'ENAME_JOB'
WHEN ParamValue('Parameter1') = 'ENAME ,JOB ,SAL' THEN 'ENAME_JOB_SAL'
...

:-\


Title: Re: Render Variable without using Boolean Varible
Post by: BigChris on 27 Apr 2015 07:56:47 AM
Is there a particular reason for not using boolean variables?
Title: Re: Render Variable without using Boolean Varible
Post by: Francis aka khayman on 27 Apr 2015 11:03:37 PM
prompt page looks like it uses radio buttons, so how can you do multiple select? or am i just too focused on detail I should ignore?