cancel
Showing results for 
Search instead for 
Did you mean: 

How can I have different decimal places on different rows in a crosstab?

former_member560462
Participant
0 Kudos

Crystal Reports 2011 and  Crystal Report for Visual Studio 2010, service pack 4

I have a very simple table where each row represents a measurement M with a timestamp T, a value V, and the number of decimals to display D

For example, my table has:

MTVD
M1T1V11
M1T2V21
M2T1V33
M2T2V43

My rows are the measurements, grouped by M, my colums are the timestamp T, my summarized field is Max of V1 so my crosstab looks like

Measurement\TimestampT1T2
M1V1.nnV2.nn
M2V3.nnV4.nn

What I want is for V1 and V2 to be displayed as a number with one place past the decimal showing, e.g. V1.n and V2.n and for V3 and V4 I want three places after the decimal to be displayed, e.g. V3.nnn and V4.nnn:




Measurement\TimestampT1T2
M1V1.nV2.n
M2V3.nnnV4.nnn

I know I can do this with a formula on the V's, but the problem with that is when I export to Excel the cells contain strings.  I want them to be numbers.

Is there any way I can tell the cross-tab for format these things by row?  I used the Format Field, Customized Number, then created a formula for the Decimals places, but it does not change based on the row.

-nld

Accepted Solutions (1)

Accepted Solutions (1)

former_member292966
Active Contributor
0 Kudos

Hi,

What you are doing should work but it would depend on how your formula is finding the row. 

For Crosstabs, you have to use the GridRowColumnValue function to find the correct row. 

So your formatting formula would look something like: 

Select Case GridRowColumnValue("M")

     "M1" : ...

     "M2" : ...

     Default: ...;

Or do an If statement like:

If GridRowColumnValue("M") = "M1" Then

     ...

Else If GridRowColumnValue("M") = "M2 Then

          ...;

Hope this helps,

Brian

former_member560462
Participant
0 Kudos

Dude!  That works quite well, thank you.  In my particular case I had the value in the table, and grabbed it with simply GridRowColumnValue("D")  which I added to the cross tab but am not displaying it.

-nld

Answers (0)