Hi,can someone tell me how I have solve this problem?I would like do this in a UltraGrid:make calculations in a cell with relation to other rows. Similar to Excel.Sample:
| Col_1 | Col_2 Row_1 | 5 | =Col_1:Row_1 * Col_1:Row_2 Row_2 | 10 | =Col_1:Row_2 * Col_1:Row_1
| Col_1 | Col_2 Row_1 | 5 | 50 Row_2 | 10 | 50
Can someone help me?The calculate property of the grid dossent work. Why: she is always on the same row.And the WinCalcManager would also not the right way. I have found the following in the help:.....Some controls (like the WinGrid) support special handling of formulas, and will not show the CalcSettings property. ......
Thanks for helpSincerelyThomas
Hi Thomas,
deheckth said:The calculate property of the grid dossent work. Why: she is always on the same row.
I'm not sure what you mean by this. There is no calculate property on the grid that I am aware of.
deheckth said:And the WinCalcManager would also not the right way.
The only problem I see with using WinCalcManager to do this is that you can't apply a formula to a single cell, you can only apply a formula to a Column. The example you have here is rather odd, though, since both of these formulas are really the same. You changed the order of the operands, but it's really the same formula with the same result. So I'm not really clear on whether you need to apply a formula to a cell or not.
If you need to perform a different calculation in each cell and the formula cannot be expressed on the column, then you are correct, WinCalcmanager will not work. In that case, I recommend that you simply use the InitializeRow event of the grid and populate the Value of the cell yourself, performing the calculations in code.
If your formula is the same for every cell, then you could apply a formula to a column. Please note that the CalcManager formula syntax allows you to specify a relative row. So if you want a cell's value to be based on the cell in the same row times the cell in the previous row, you can do that with a formula on the column. There's a sample of this kind of formula included with the WinCalcManager samples which are installed with the NetAdvantage SDK.
Hi Mike,thaks for answer!for explanation my sample:normely it isent the same result in each calc.-cell. In this case it was not a good sample. Whatever, your Replay answered my question. But not as hoped. The way to set then formula to an relative row is not the right way for me. Why? The relatet row ist diferent in each cell.
So remains for me nothing more than do in code what I hav to do.
SincerelyThomas
In that case, the InitializeRow event is your best option.
Hi from Frankfurt,
In first step, Yes It Is!. But I must recalculated the results on each changed value in based cells. So ther will be some more to do. At first time my hope was, a cell with formula recalculated herself if the based cells.values is changed.
But what shels, "A developer must do what a developer must do".
Have a nice weekend
Thomas
Handling InitializeRow is probably all you need to do. The event will fire any time a value in any of the cells in the row changes.