I 've downloaded RowSummaryAverageWithNullcs sample project (article id : 10019) from Infragistics website. I 've added a column in testdata function.
dtData.Columns.Add("Column 2", typeof(int));
In initializelayout event,
if i use // formula 1 line as :
e.Layout.Bands[0].Summaries["Summary"].Formula = "sum(if(isblank( [Column 1]) , [Column 1] , [Column 2] ))";
it works fine. and displays sum.
but if i use //formula 2 line :
e.Layout.Bands[0].Summaries["Summary"].Formula = "sum(if([Column 1] > [Column 2], [Column 1] , [Column 2] ))";
it says : value# incorrect type of argument or operand.
can 't i use column comparision in formula ?
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Summaries.Add("Summary", Infragistics.Win.UltraWinGrid.SummaryType.Formula, this.ultraGrid1.DisplayLayout.Bands[0].Columns["Column 1"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
//formula1 e.Layout.Bands[0].Summaries["Summary"].Formula = "sum(if(isblank( [Column 1]) , [Column 1] , [Column 2] ))";
//formula2 e.Layout.Bands[0].Summaries["Summary"].Formula = "sum(if([Column 1] > [Column 2], [Column 1] , [Column 2] ))";
e.Layout.Bands[0].Summaries["Summary"].DisplayFormat = "Sum= {0}";
}
Hi,
I'm not famililar with the sample you are referring to here. Can you post the link to where you got it?
I don't see anything wrong with your formulas here - assuming that the column keys are actually "Column 1" and "Column 2".
Wait, I take that back. The formula you have here actually does not make sense for a Summary. If you reference a Summary in a column, then you are referencing the entire column. Sothe IsBlank function has no meaning for a column reference, it only has meaning for a single value like a cell.
here is a link for Article ID : 10019
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10019
Actually this link can be easily found by opening
http://devcenter.infragistics.com/Support/KnowledgeBase.aspx
knowledgebase web page , simply type article ID and hit GO. very simple.
and as it 's shown in sample
e.Layout.Bands[0].Summaries["Summary"].Formula = "average(if(isblank( [Column 1]) , 0 , [Column 1] ))";
you can use isblank function and it has a meaning of course.
but actually what i need to do is :
e.Layout.Bands[0].Summaries["Summary"].Formula = "sum(if( [colmydate] > date(2009,1,1) , if( [colmydate] < date(2009,3,3) , [colmymoney] ,0 ) ,0 ))";
if mydate between 2009.1.1 and 2009.3.3 add mymoney to sum otherwise don 't add.
what is wrong in that formula ?