سؤال

I have a report that displays different rates for different items. One of these items is "mileage" and has a rate that has fractional cents (0.565).

We want to display the full 0.565 for these rates, and show all other rates with two decimal places.

To facilitate this, I used a formula in Format Field > Number > Customize for both Decimals and Rounding that looks basically like this:

if({RATE_TYPE}='MILEAGE')then 3 else 2

This appears to be working correctly in Crystal Reports. For mileage, 3 decimal places are shown, and it is rounding to 3 decimal places.

In Crystal Reports Viewer (and subsequent exports), it is showing 3 decimal places but it is rounding to 2 decimal places.

I am using Crystal Reports 2008 (12.3.0.601), and Crystal Reports Viewer:

<system.web>
  <sectionGroup name="businessObjects">
    <sectionGroup name="crystalReports">
      <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
    </sectionGroup>
  </sectionGroup>
  ...
  <compilation debug="true" defaultLanguage="c#">
    <assemblies>
      ...
      <add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      ...
    </assemblies>
    <buildProviders>
      <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    </buildProviders>
  </compilation>
  ...
  <httpHandlers>
    ...
    <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    ...
  </httpHandlers>
  ...
</system.web>
<system.webServer>
  ...
  <handlers>
    ...
    <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
    ...
  </handlers>
  ...
</system.webServer>

(sorry about the wall of code)

Has anyone encountered this before? Is there a known fix?

هل كانت مفيدة؟

المحلول

You will need to set your default values for decimals and rounding to the maximum amount you are trying to achieve. So in your case it would be 3.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top