From the Infragistics documentation, it sounds like I should be able to write a formula like sum( [Column001] : [Column120]) to add up the values in all 120 columns starting with column001. But the calculation fails at runtime if I do this. Is this kind of Excel-like range summation supported?
If not, the second question is I would be forced to use something like sum([Column001], [Column002], [Column003], ....., [Column120]). Can I programmatically generate this string and associate the formula string to the unbound column? How do I programmatically associate a formula string with an unbound column?
Third question, is there a limit on the number of arguments to the sum() function? The Microsoft provided sum() function seems to limit it to 30 arguments but for the Infragistics sum function could handle over hundred when I tried thru designer. So is there a limit on the number of arguments?
Thanks!
vrn said:From the Infragistics documentation, it sounds like I should be able to write a formula like sum( [Column001] : [Column120]) to add up the values in all 120 columns starting with column001. But the calculation fails at runtime if I do this. Is this kind of Excel-like range summation supported?
No, the CalcManager does not have any concept of the order of the columns in the grid so it can't do this sort of range summation.
vrn said:If not, the second question is I would be forced to use something like sum([Column001], [Column002], [Column003], ....., [Column120]). Can I programmatically generate this string and associate the formula string to the unbound column? How do I programmatically associate a formula string with an unbound column?
You set the Formula property on the column, just as you would at Design-time.
vrn said:Third question, is there a limit on the number of arguments to the sum() function? The Microsoft provided sum() function seems to limit it to 30 arguments but for the Infragistics sum function could handle over hundred when I tried thru designer. So is there a limit on the number of arguments?
I don't beleive there is any arbitrary limit on the number of arguments. If you do encounter a limitation, you should report it to Infragistics Developer Support as a bug. Submit a Support Issue
Thanks Mike! That was very helpful!
Two related questions
1. I remember reading that CalcManager supports total columns but I cannot find an example of this. In my case, I have
Band1 has "QtyTotal" field
Band2 (Child of Band1) has "Qty" field
What is the formula I use to total "qty" in band2 and put it into "qtytotal" on band1?
2. In all examples I have seen the formula uses some notation like "//" for eg. SUM( [//col1], [//col2]). In one of the previous email thread you talked about using something like [../band1/col1] . I am guessing there is some "xpath" like syntax to referencing the fieldname. If it is quick, can you explain? If not, give me a pointer where I can find it. I looked at the online CalcManager documentation http://help.infragistics.com/NetAdvantage/NET/2008.1/CLR2.0/ and there is no mention of the syntax to reference fieldname in formulas.
Hi,
Basically you need to use relative syntax. Since the formula is on a parent band's column, use the childband's name and column's name separated by '/':
sum( [band 1/col] )
Sandip
Thanks Sandip! Few followup questions
1. Is it possible to have the UltraCalcManager sum across UltraWinGrids? So I want the value change on a column in grid1 to affect some calculated value in grid2?
2. I do see a number of place where "//" is used. For example on this webpage http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WinCalcManager_Setting_WinCalcManager_Formulas_at_Run_Time.html there is an example which set the formula
cs3.Formula = "[//txtNumber1] + [//txtNumber2]";
I have also seen ".." used. In one of the earlier thread http://forums.infragistics.com/forums/t/5244.aspx Mike Saltzman says The formula for the Sum column in Band 0 would look something like this "sum( [../band 1/item] )" . I am curious about the ../band1 and the //txtNumber1 in the above example. What does that ".." (double dot) and "//" (double slash) signify?
Where are this syntax described?