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

Using dash(-) in an IF-Statement

Started by DiGzâ„¢747, 19 Dec 2008 10:56:34 PM

Previous topic - Next topic

DiGzâ„¢747

Hi Guys,

I'm working in an enhancement right now and a particular data item on the report is required to convert zero values into a dash ('-').  I tried using the following statements below but I'm getting parsing error in each statement.

if([MI_PTD].[Budgt Hrs] =0) then('-') else ([MI_PTD].[Budgt Hrs])
if([MI_PTD].[Budgt Hrs] =0) then("-") else ([MI_PTD].[Budgt Hrs])
if([MI_PTD].[Budgt Hrs] =0) then '-' else ([MI_PTD].[Budgt Hrs])
if([MI_PTD].[Budgt Hrs] =0) then "-" else ([MI_PTD].[Budgt Hrs])

What character should I enclosed the dash character with? 

Hope you guys could help me out on this.

Regards,
Digz



Sunchaser

Hi,

My opinion is that you shouldn't try to change the type of data return by your field "[MI_PTD].[Budgt Hrs]", by converting 0 to "-"; you'll have then mixed contents of number & char, I'm not sure it's good (if you have calculation somewhere).

Isn't it possible simply to use a conditionnal formatting based on "[MI_PTD].[Budgt Hrs]", the type will be boolean, the expression something like [MI_PTD].[Budgt Hrs]=0, and you'll change the text displayed in the report ("-" instead of 0) when the variable returns "true".

It's just an idea, It could be wrong depending on your case...

Hope it helps.
vinc.

VisioX

Did you tried to set the "Zero Value Character" to "-" in the Data-Format?