468,556 Members | 2,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,556 developers. It's quick & easy.

Crystal Reports Custom Rounding/Default Number Formatting in crosstable

Pittaman
Hello

I am creating some crystal reports (for visual studio 2005) based on the content of certain .NET objects. I'm doing this in .NET 2.0.

For one of them I'm using a Cross-table to summarize the information of a bunch of objects. The actual data is numeric. Since these reports are meant to be flexible number formatting must be configured as defined by the requirements.

For example, sometimes the values will have to be rounded to 5 decimal places, sometimes two, ...

One way to do this in crystal reports is change the number format for the value field in the cross-table. However, this results in a "custom number format" as opposed to the "system default number format" (which takes the formatting from the operating system cultural settings). Once the custom number format is chosen, the decimal seperator, thousand seperator etc ... is defined for the report and it will never change, regardless of the user's regional settings. The system default settings usually have a rounding of 2 decimal places, but I want to be able to change this.

This is obviously a problem. I can see two easy choise: I define that only rounding with 2 decimal places is supported OR I define that the report will always use the same decimal seperator etc ... regardless of the regional settings of the user.

Neither options are acceptable.

I tried in .NET to loop through all elements of the report, defining the number format for all numeric fields. However, there seems no way to get into the properties of the fields in a crosstab programmatically. I have looked around and it seems simply impossible to have the flexibility I want in Crystal Reports.


If anyone has any ideas I will be VERY happy!


Thanks.
Sep 23 '08 #1
2 11263
Hello

For normal tables (so not cross-tables) I'm already able to use a formula to convert the number to text, which allows me to specificy the amount of rounding in the formula itself. This works well for regular tables (and it can even help me to solve another problem, empty cells when the value is invalid, instead of showing a 0).

However, this approach seems not possible for cross-tables because we need a summarize field to get the value. We can only COUNT the formula field because it returns a string. I can not let it return a number because then I once again lose the rounding capabilities. So really what would solve my problem is to be able to modify the summarization to be ToText(Sum(MyField), 4) (4 decimal places).

But I do not think this is possible... or is it?
Sep 24 '08 #2
Hello,

Answering to my own post again. I think I found a solution to the problem. Using the following link:

http://social.msdn.microsoft.com/For...-1b7aaaad8678/

I configured a bunch of Parameters to define the number format (you can use a formula on the fields for number formatting to insert the value of the parameter). I then set each of these parameters programmatically based on the current culture of the application and I allow the rounding to be set seperatly, thus overwriting the default two digits rounding and keeping all other formatting current culture dependent.

It's a pain to configure each of the parameters if you ask me, but it is thus far the only real solution to the problem I've found.


Keeping invalid values blank instead of zero in a cross-tab is something I still haven't figured out yet...
Sep 30 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Zoury | last post: by
2 posts views Thread by Mythran | last post: by
7 posts views Thread by p | last post: by
17 posts views Thread by Peter Proost | last post: by
1 post views Thread by =?Utf-8?B?VGVycnk=?= | last post: by
3 posts views Thread by Miro | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.