Hi,
I have the following senario.I have an ultraGrid with columns A,B,CI have a second ultraGrid with columns D,E,F
Both grids will have the same number of rows, but will be loaded from different SQL tables.
My question is how can I assign a formula to column E(of the second grid) but taking values from the first grid.
For example I want column's E formula to be like " [//ultraGrid1/_band_0/B/] * 5 + [//ultraGrid1/_band_0/C/] /2 "
Is this possible?
Regards,
Nicolas
Hi Nicolas,
A formula in a cell is relative to other cells in the same row. So, for example, if you applied a formula to column C, you could do something like this:
"[A] + [B]"
This would make column c equal to A + B in the same row.
If you refer to a column in a different grid, then the cells do not share the same row, so there's no contect for the calculation. You can speficy a formula that refers to a specific cell in a grid. So, for example, you could use a formula like this on Column E:
"[//ultragrid1/_band_0/B(0)"
The 0 in parens at the end of this formula indicates row 0 in column B.
But... since there's no way to get the index of the row in a formula and since you can only apply a formula to an entire column and not to a cell, I'm afraid there is no way to do what you want here. At least not using a formula. You could, of course, use the InitializeRow event of the second grid and do the calculations yourself in code.
I tried it but it does not work. It displays #!REF
I'm not sure what you mean. What did you try? As I explained, there's no way to do what you are asking for using a formula.