If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How to IF ELSE THEN AND IF ... in Report Studio

Started by andy_mason_84, 24 Jul 2012 08:13:05 AM

Previous topic - Next topic

andy_mason_84

Folks,

I have a really simple question but for some reason i am having a mental block ...

I have a report with say 5 seperate prompts on the prompt page ...

I have put a Report Expression into the main body on the report to basically show the parameters if they are selected in the header so if people print the reports they know what they have filtered on.

This is the code i have used.

IF (ParamDisplayValue('Module_Name') is NULL)
THEN
('')
ELSE
('Module(s): '+ParamDisplayValue('Module_Name'))


Right,

Now I want to basically say

IF (ParamDisplayValue('Module_Name') is NULL)
THEN
('')
ELSE
('Module(s): '+ParamDisplayValue('Module_Name'))

IF (ParamDisplayValue('Company_Name') is NULL)
THEN
('')
ELSE
('Company(s): '+ParamDisplayValue('Company_Name'))


So that if the select no parameters then nothing will appear ...

If they just select a Module then just Module Name will Appear

If they select just a Company then Companies will appear

and if they select both then they will both appear.

I can't have seperate if statements as it doesnt like it but i dont want to have code for every possible scenario ...

Any suggestions?

Cheers,

Andy

MFGF

How about putting the two if expressions into separate items and displaying both items? Are these layout calculations or query calculations?

Cheers!

MF.
Meep!

andy_mason_84

Hey,

They are just Text Items with Source Type as Report Expression.

I could in theory have 5 text items next to each other, just wanted to have it all in one.

Thanks for the idea though ... will give that a whirl.

cschnu

As MF said try putting them as separate items and then Report Studio will handle printing them or not.  If they don't select an optional parameter Report Studio will not print the entire expression. You can still put each expression on the same line by using a block or a table.