Hello,
my requirements are to sum all the(or some of them) cells on a wingrid of a column and the result use it for other calculation or put it on label or else. How can i do that?
thank you.
Good point. You really would not be able to fix it in a case like that unless you knew the name of the reference that the CalcReference for the grid is using interally. I think it goes something like: "_band_0". Like I said, this is almost certainly a bug.
Fortunately i'm using datatable, but how can i fix this problem if i have a custom List of object as a datasource of the grid? something like this
public class Person { private String _Name; private double _Salary; public double Salary { get { return _Salary;} set { _Salary = value; } } public string Name { get { return _Name; } set { _Name = value; } } }
ultraGrid2.DataSource = TestData2();
public List<Person> TestData2() { List<Person> persons = new List<Person>(); Person ps = new Person(); ps.Salary = 1500; ps.Name = "John"; Person ps1 = new Person(); ps1.Salary = 2100; ps1.Name = "Jim"; persons.Add(ps); persons.Add(ps1); return persons; }
ps:I have submited a new incident.
Hi Walter,
I took a look at your sample and the problem appears to be with the key of the first (and only) band in the grid. You are assigning a DataTable as the grid's DataSource, but this table has no TableName set.
So the grid and the Formula Builder are assuming that the key of this band should be "Band 0", which is what you have in your formula.
But the grid's CalcReference for this band is using a different key for some reason. This is probably a bug, and I encourage you to Submit an incident to Infragistics Developer Support. Just include your sample project and a link to this thread.
Anyway, this is very easy to fix. All you have to do is set the TableName on your DataTable to "Band 0" and it works fine.
Hi Mike,
perhaps its a syntax problem on the formula. I have made a simple example and attached to this discussion. It is a form that has a wingrid with 1 column and an ultranumericeditor. Basically i want to sum all cells of this column and the result multiplied by 2, finally show this result on the ultranumericeditor.
Hi Walter.
This all sounds like a pretty simple case of using formulas to me. I'm having a hard time understanding what you are asking for here. Are you having trouble with the syntax? Or setting up a NamedReference? Or applying a formula to an UltraNumericEditor?
Personally, I would use a NamedReference for anything you don't need to display to the user. It doesn't make sense to use a control just to calculate a formula that is never displayed.
To sum grid column in a NamedReference, you would use the Sum function and pass in the grid column reference.