Hello Team,
We want to calculate the values at run-time manually. The formulas are not fixed, the users can create the formula of their choice. Our data is as follows
Unit Value Formula
LF 10
SF 20
VL 30
R1 SQRT (LF * SF)
R2 SUM (VL , LF , SF)
The 'R1' and 'R2' are the summary or Grand Total row, the result would be displayed in the value coulmn on the basis of the Formula entered in their respective rows.
How to implement the calcManager manually at runtime for these Rows ?
We would also be using all the built-in functions provided by infragistics Formula Builder (for eg. cos,abs, average ..etc).
Looking forward to your reply.
As we cannot give formulas to the rows / cells we have assigned the formulas to the columns in the second (hidden) grid and the result of the second grid would be set in the rows of first grid. We know it is a little lengthy process, but we thought this is the only work around for it, provided you suggest some other better solution for it .
Looping is probably the best way to do this.
If the grids are both sorted the same way, you could use the index of the row in the second to find the row in the first grid. But then you would have the added difficulty of trying to keep the sorting in synch.
What's the point of having the second (hidden) grid, though?
Thank you Mike. It did work.
We are attaching an sample application for your reference. In this we have two grids Grid 2 will be hidden. any changes made to the 'value' column of 'Grid 1' is to be reflected in the 'Grid 2' in there respective column.
When the values in the 'Grid 1' 'value' column changes, we are changing the value of its corresponding coulmn in 'Gird 2' by looping through in 'Grid 2' columns.
Is there any way to get the values of 'Grid 1' column directly to its corresponding columns in 'Grid 2' instead of looping through in the 'Grid 2' and set the value ?
I'm not sure I understand the question. There is Formula property on the column and you set it to the formula you want. What part of this are you having trouble with?
I recommend using the InitializeLayout even for something like this.
e.Layout.Bands[0].Columns[F1].Formula = "(2*[LEN]*[HGT])+(2*[WID]*[HGT]) + ([LEN]*[WID])";
As it is not possible to set a formula rowwise (on a single cell), we thought of a workaround for it. We are dispalying the formulas column wise i.e. our Data would be as follow
LEN WID HGT F1
10 20 30 (2*LEN*HGT)+(2*WID*HGT) + (LEN*WID)
We will have only one row in a grid. the Units would be displayed in the columns. The user will edit the values in 'LEN','WID' and 'HGT' column and 'F1' will have a formula.
We have to set the formula to the F1 column at the run time. How to assign the formula to the column at the run time. We can have more than one formula coulmns. We retirve the data in the dataset and willl have to go in the loop to assign the formula to the respective columns.
Can you please tell us, is there any way to assign a formula to a columns at run time ?