Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Impromptu Condtions with if else command

Status
Not open for further replies.

dm21

Programmer
Feb 6, 2003
74
CA
Hi,

I want to include different condtions in my filter depending on the prompt.

Is it possible to do it?

if then Else command does not allow conditions.

for eg.
if ?city?='TORONTO' Then (a.city_code = b.city_code)
elseif ?city?=....

If this is not possible is there any other way I can do it except database procedures?

Thank you.
 
dm21,

See the thread thread401-384839 for a discussion of conditional filters.

Regards,

Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
I am using a if..then..else command with a promted variable.

1st Define the prompted variable

2nd define a calulated field called called a.city.code & in this field have the calulation go something like
(if ?prompt? = "Toronto") then (b.city.code) else (if ?prompt? = "New York") then (c.city.code) else if (?prompt? = "Vancouver") then (d.city.code) else ("No city code")

3rd, filter/ sort or group on this calculated field

Hope this helps
Bruce
 
I am using a if..then..else command with a prompted variable.

1st Define the prompted variable

2nd define a calulated field. Call it a.city.code & define something like
(if ?prompt? = "Toronto") then (b.city.code) else (if ?prompt? = "New York") then (c.city.code) else if (?prompt? = "Vancouver") then (d.city.code) else ("No city code") or what ever you need.

3rd, filter, sort or group on this calcualted field (a.city.code). You don't need to show this field on the report itself. Depending on the calculations in this field, the report might run much slower than before.

Hope this helps
Bruce
 
Thank you Dave and Bruce.

It worked for me.
 
Hi,
I don't think this is possible in Impromptu but I am sure this can be done easily using Powerprompt.

Prasad.
 
prasad,

It is not possible exactly as I had mentioned in my first email but there is a work around.
for eg.
a.city_code = if (?prompt?)= 'TORONTO' then (b.city_code) else (c.city_code)

Now I am having another problem, I am using predefined prompts from Catalogue. In my condition
If ?prompt? = 'TORONTO' ... else If ?prompt? = 'MONTREAL'....


The first prompt takes values when I run the report but the second one does not.

i.e it results in if 'MONTREAL' = 'TORONTO' else if '' = 'MONTREAL'

But if I use promt from prompt manager ie. native to the report this works fine.

I am asking cognos if there is any bug in Impromptu 7.0.

 
The previous problem of prompt was a bug in 7.0 which was fixed in MR2 version.

Prasad,
When you use hot file for reports (which are basically imr)

What happenes when that imr is moved to some another location? Do you have to create your main report again ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top