Crystal Reports Custom Rounding/Default Number Formatting in crosstable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pittaman
    New Member
    • Aug 2007
    • 20

    Crystal Reports Custom Rounding/Default Number Formatting in crosstable

    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 programmaticall y. 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.
  • Pittaman
    New Member
    • Aug 2007
    • 20

    #2
    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(MyFi eld), 4) (4 decimal places).

    But I do not think this is possible... or is it?

    Comment

    • Pittaman
      New Member
      • Aug 2007
      • 20

      #3
      Hello,

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

      The home for technical questions and answers at Microsoft. Get started asking, answering, and browsing questions about products like .Net, Azure, or Teams.


      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 programmaticall y 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...

      Comment

      Working...