Hi, I recently upgraded infragistic from 2007.3 to 2011.2. When using formula to calculate with 'product' and one cell is null, the behaves are different. Below are example code that can be run in both version (just add WinGrid and WinCalcManager controls).When running in 7.3, the 'total-prod' column is 0 and Div is 'Infinity' (In my app, it displayed as 'NaN'). When running in 11.2, the 'total-prod' column is 1000 and div column is '#DIV/0!', Is there any way (setting some properties) that I can get back to old behave since our users get used to that? When using product, the result is not acceptable since one of cell values is null. Thanks.
namespace WinGrid{ public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Salary", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("age", typeof(int)); dt.Columns.Add("total-multi", typeof(int)); dt.Columns.Add("total-prod", typeof(int)); dt.Columns.Add("div", typeof(int)); dt.Rows.Add(new object[] { 100, "Chris", DBNull.Value, "02/03/2012", 10 }); dt.Rows.Add(new object[] { 101, "Mary", 8489, "05/04/2010", 10 }); dt.Rows.Add(new object[] { 102, "Ajay", 564, "06/05/3022", 10 });
// this.ultraGrid1.DisplayLayout.Bands[0].Columns.Add("UnboundColumn", "Total");
DataColumn[] dc = new DataColumn[1]; dc[0] = dt.Columns["ID"]; dt.PrimaryKey = dc; this.ultraGrid1.DataSource = dt; this.ultraGrid1.DataBind();
}
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns["total-multi"].Nullable = Infragistics.Win.UltraWinGrid.Nullable.Null; e.Layout.Bands[0].Columns["total-multi"].Formula = "[ID]* [Salary]* [age]"; // "product([ID], [Salary], [age])";
e.Layout.Bands[0].Columns["total-prod"].Nullable = Infragistics.Win.UltraWinGrid.Nullable.Null; e.Layout.Bands[0].Columns["total-prod"].Formula = "product([ID], [Salary], [age])";
e.Layout.Bands[0].Columns["div"].Nullable = Infragistics.Win.UltraWinGrid.Nullable.Null; e.Layout.Bands[0].Columns["div"].Formula = "[ID]/[total-multi]";
} }}
Hi,
This change in behavior was intentional. I beleive it is documented in the breaking changes section of the readme file somewhere along the way.
The reason for these changes was to bring the UltraCalcManager more into line with what Excel does. The current behavior more closely mimics the behavior of Microsoft Excel.