Pregunta

Good Morning!

I am working in Crystal Reports 2008 & have a report template that I'd like to use with various dynamic parameters (called in a downstream application).

My data can vary from being on a scale of 0-1 to a scale of 1,000-10,000.

I'd like to display it with 3 significant figures so when the report pulls in a dataset that

looks like this --> displays like this

0.76895 --> 0.769

0.6672 --> 0.667

1.0335 --> 1.03

but when the data set

looks like this --> displays like this

12,125.65 --> 12,100

956.35 --> 956

4,352.22 --> 4,350

My current work around is to make two templates-- one to use with my small value data, set to display 3 decimal places; and another to use with my large value data, set to display no decimal places.

I was wondering if there was a way to set significant figures displayed rather than decimal points?

Oh! I would do it in SQL first and pass it in as a string but I need these as numeric values so I can summarize them elsewhere in the report. Thanks.

¿Fue útil?

Solución

If you right-click on your numeric field and choose format, Customize..under the number tab you get a bunch of choices to set the decimal separator, how many decimals to display, etc. choosing the formula button next to Decimals, you could put in a formula that looks at the amount of digits after the decimal dot and then either set the decimals to 2 if there are more than 3 decimals, and to zero decimals if there are 2 decimals. They key here is to get the order right. You want to check for the 2 decimals first and then for 3 or more decimals. If you do it the other way around the formula will display everything without decimals.

Hope that helps,

Chris

Otros consejos

Use something like this.

ToNumber(Totext(<<DatabaseField>>,0,""))
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top