How to avoid null values turned to 0?

Stimulsoft Reports.NET discussion
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

How to avoid null values turned to 0?

Post by Jennypi »

Hi

In my datasource, some values are "null".
But when they are displayed by the report, they are shown as "0". I've selected "Hide zeros" option, except that those values are still taken into account when calculating an average for example.
For my average calculation, I don't want to count only the values that are not "0", because there can be real "0" values. I just want to discard null values.

How to avoid the conversion of null values into "0" values ?

thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to avoid null values turned to 0?

Post by Alex K. »

Hello,

Can you please send us a sample report with test data which reproduce the issue for analysis.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Re: How to avoid null values turned to 0?

Post by Jennypi »

Yes, here is a sample report + data.
As you can see, for fruit length the average is wrong, because it takes into account the empty values.
For Brix, where there is a "real" 0 value (that's why I don't want to hide zeros in the component options), the average is good.

Thanks for your help.
Attachments
report.zip
(5.08 KiB) Downloaded 244 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to avoid null values turned to 0?

Post by HighAley »

Hello.

We have reproduced your issue.
We need some additional time for analysis.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to avoid null values turned to 0?

Post by HighAley »

Hello.

You should set the Convert Nulls property of the report to false
This property didn't work for CSV export.
We have made an improvement. The patch will be available in our next prerelease build tomorrow.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Re: How to avoid null values turned to 0?

Post by Jennypi »

Thank you for investigating.

I'm actually not working with a csv file, it was just to provide you with an example. My datasource is an SQL server DB.

I've tried to set the Convert Nulls property to false, but then I'm getting an error "Specified cast is not valid" (before my data are loaded, as I don't even see the form where I'm supposed to choose the parameters).

Would it help if I send you my report (so you could see the code, but datasource won't work)?

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to avoid null values turned to 0?

Post by Alex K. »

Hello,

Please send us a sample report with test data which reproduce the issue for analysis.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Re: How to avoid null values turned to 0?

Post by Jennypi »

Hello,

Unfortunately, I can't send you a report with test data. As I told you before, my datasource is an SQLserver database.
Nevertheless, I attach to this post my report and a screenshot of the "unvalid cast" error message. Maybe it will help you understand what is happenning.
report.mrt
(1.18 MiB) Downloaded 261 times
error.png
error.png (51.19 KiB) Viewed 4229 times
Thank you for your help!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to avoid null values turned to 0?

Post by Alex K. »

Hello,

Please try to check the last prerelease build and let us know about the result.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Re: How to avoid null values turned to 0?

Post by Jennypi »

Hello,

I've finally managed to have the latest prelease build (Stimulsoft Reports.Net 2014.01.08) installed.

I have set the Converts Null property to false.
Now I don't get the same error message, but there is a strange behavior with the average calculations.
In attachment you will find an example of report with data file.
As you can see, the avg calculation is fine for Fruit length column. It is not considering the empty values anymore. But look at the three Flesh firmness columns and at the Brix column. The calculations are wrong or not done. I don't know what's going on...
Can you please help me?

Thanks in advance.
Attachments
Report.mrt
(74.85 KiB) Downloaded 298 times
data.csv
(879 Bytes) Downloaded 200 times
Post Reply