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

Distinguish rounded zero from "real" zero

Started by sagethegemini, 27 Oct 2015 06:25:38 AM

Previous topic - Next topic

sagethegemini

Hello,
I have a value calculated this way :
A = sum(cast( [my_elementary_value];decimal(18;0)))
--> Non-rounded value
B = cast(cast( A /5;Decimal(16;1) )+0,5;INTEGER)*5
--> Rounded value

I use the B value in my reports. The result is used in crossed tabs, so the returned value must not be char.
I'm trying to find a way to make B display a "special" 0 (like +0) if A doesn't equals zero before rounding.

Example :
A = 2 => B = +0 (the zero is rounded)
A=0 => B = 0

Lynn

Quote from: sagethegemini on 27 Oct 2015 06:25:38 AM
Hello,
I have a value calculated this way :
A = sum(cast( [my_elementary_value];decimal(18;0)))
--> Non-rounded value
B = cast(cast( A /5;Decimal(16;1) )+0,5;INTEGER)*5
--> Rounded value

I use the B value in my reports. The result is used in crossed tabs, so the returned value must not be char.
I'm trying to find a way to make B display a "special" 0 (like +0) if A doesn't equals zero before rounding.

Example :
A = 2 => B = +0 (the zero is rounded)
A=0 => B = 0

You could do it in the layout and use a conditional style to distinguish 0 from anything greater than 0 but less than 1, plus the same for negative numbers if those are possible for your data.

Lynn

Oh, sorry....I just realized this is in the FM section rather than in the Report Studio section.

I suspect you might need another data item to indicate if the situation exists or not that the author could then use as the basis for styling in the layout.

sagethegemini

Thanks for your response. I have created a dataitem like this :

CASE

WHEN
(
B = 0
AND ( A = 0
OR A   is null
))
THEN 0

WHEN
(
B = 0
AND ( A  <> 0
))

THEN +0
else B
end


I used the same code to generate a flag dataitem (as you suggested) "Flag value is rounded" that would output "Not -Rounded" in the first case and "Rounded" in the second one.

Problem is when i try to cross the flag with other dimensions in QueryStudio, I get the classic error "Selected non-aggregate values must be part of the associated group" as if the group by clause was missing...