Page 1 of 1

Totals - ignore NULL values

Posted: Mon Mar 18, 2013 2:17 pm
by mmmmmm
Hello,

I have data table with some NULL in some of the rows.
I am trying to compute Totals.Min value over a column, but I am getting a 0 as the min and I suppose that this is because of the NULL values.

Is there a way to exlcude the NULLs from computation of the MIN. Such as there is for SumIf and CountIf?
The same question goes for Avg I guess.

Thank you!

Re: Totals - ignore NULL values

Posted: Tue Mar 19, 2013 6:28 am
by Alex K.
Hello,

Please check the last prerelease build.
If the issue still exist please send us a sample report with test data which reproduces the issue for analysis.

Thank you.

Re: Totals - ignore NULL values

Posted: Tue Mar 19, 2013 7:43 am
by mmmmmm
Thank you for your quick answer.
The problem happens in the latest release also.

The exact scenario is the following: a column of positive values having the first element (at row[0]) NULL. The element on the first row is NULL.
With all the other values being greater than 0, the Min is always zero.

Value
------
NULL
12
134
11

If I put a value (non null value) on the first row, then the Min is computed correctly.

Note: I am adding the formula in code behind as below:

Code: Select all

report.RegData(tblDR.TableName, tblDR);                            
report.Dictionary.Synchronize();
report.CalculationMode = StiCalculationMode.Compilation;

StiTable table = new StiTable();
StiTableCell minCell = table.Components[nMinCellIdx] as StiTableCell;

string sMinExpresion = String.Format("{{ Totals.Min({0},{0}.{1}) }}", tblDR.TableName, Stimulsoft.Report.CodeDom.StiCodeDomSerializator.ReplaceSymbols(column.ColumnName));                    

minCell.Text.Value = sMinExpresion;                        

Re: Totals - ignore NULL values

Posted: Wed Mar 20, 2013 6:33 am
by mmmmmm
Can anyone suggest a work around for this please?

Re: Totals - ignore NULL values

Posted: Wed Mar 20, 2013 8:29 am
by Alex K.
Hello,

Please try to set the ConvertNulls property for the report to false.

Thank you.

Re: Totals - ignore NULL values

Posted: Wed Mar 20, 2013 8:57 am
by mmmmmm
Hi,

I've tried ConvertNulls = false, but no help. The issue still remains.

Thank you

Re: Totals - ignore NULL values

Posted: Wed Mar 20, 2013 9:39 am
by mmmmmm
Looking inside with reflector:

It looks like the Stimulsoft.Report.Dictionary.StiMinDecimalFunctionService.Init() either never gets called or it gets called but never gets to initialize the minimum for the first time due to not meeting the conditions:

Code: Select all

public override void Init()
{
    if (!base.RunningTotal || base.IsFirstInit)
    {
        this.minimum = 79228162514264337593543950335M;
    }
}
Please note that I am adding all data sources and table to page dynamically from code behind.

What do you think?

Re: Totals - ignore NULL values

Posted: Fri Mar 22, 2013 6:26 am
by Alex K.
Hello,

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

Thank you.