Wednesday, March 7, 2012

Decimal problem with expression

Hi,

I've made a new report with a matrix and subtotals. But i don't want to have subtotals but subaverages so i used the inscope function. This is my expression, as you can see very long :)

=iif(InScope("groups"), iif(InScope("items"), Iif(Fields!SCO_SCORE.Value=0,"",Fields!SCO_SCORE.Value), iif(sum(iif(Fields!SCO_SCORE.Value>0,1,0))=0,"",((sum(Fields!SCO_SCORE.Value)*Fields!IC_WEIGHT.Value)/sum(iif(Fields!SCO_SCORE.Value>0,1,0))))), iif(InScope("items"), "In Subtotal of ColumnGroup1", AVG(Fields!SCO_SCORE.Value*Fields!IC_WEIGHT.Value)))

The output of this function is a number with no decimals in the matrix. for example 2

But this is not the problem, this expression works but i wanted to make the exact same new report using this exact same function. I've made everything this report but when i run it i get a number with 2 decimals for example 2.00

I really don't know how to fix this? I did exactly the same as the first time? Anyone who knows the source of this problem? is it a bug?

Greetz

Maybe the query / underlying dataset field datatypes have changed from integer to double/decimal?

Regardless, you can always explicitly set the format property on the textbox to get a particular formatting. In your case you should set the format property to N0 to achieve numeric formatting with zero decimals.

-- Robert

|||I am using RS 2000. Can someone please help me learn to do this? I want to be able to format numbers in a text box to only display whole numbers and commas, no decimals.|||

Use the following link as a starting point into the MSDN documentation for numeric formatting: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp

It should help you finding a format code setting that will achieve what you are looking for.

-- Robert

No comments:

Post a Comment