Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Different formulas in cells in a column
posted

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:

  •    + with formula

                 | 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

  •    + And the result I wont

                 | 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 help
Sincerely
Thomas

Parents
  • 469350
    Verified Answer
    Offline posted

    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.

Reply Children