I want Divide by zero to produce zero

Originally Posted 12 January 2017, 5:21 am EST

  • Originally Posted 12 January 2017, 5:21 am EST

    Hi

    Is there any way in which I can configure Flex Reports to treat NaN as zero so that expressions return zero and running totals show the correct total rather than NaN.

    I am new to Flex Reports. I am in the process of converting all our reports to it. One problem I have found is that we have lots of expressions that may result in divide by zero. For example Total / Quantity where the quantity is zero. Our old report writer simply treated this as zero but Flex Reports is showing NaN which then also means that running totals show NaN.

    I can resolve the problem by applying IIF statements to check to see if the divisor is zero and thus return zero as shown below but we have hundreds of expressions like this and tracking them all down will be challenging. Also as seen below this makes the expression more complex than it needs to be.

    iif (Quantity = 0,0,Total / Quantity)

    Regards

    Ali
  • Marked as Answer

    Reply

    Hi,
    I could not replicate the same issue at my end with the latest version of the report.
    The C1FlexReport uses the below conditions without any exception(s):
    1) 100/0 => Infinity(∞)
    2) 0/100 => zero (0)
    Please find the report file attached.

    If you are using any other version.Please try with the latest version which can be downloaded from the link below:
    For V2:

    For V4:
    http://prerelease.componentone.com/dotnet40/C1WinForms/2016-T3/C1WinForms.4_4.0.20163.226.zip

    Hope, this will solve your issue.

    Thanks,
    Sonu

    2017/01/DevideByZero.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels