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
2306
Verify if a value of a cell is True or False and then sum
posted

Hello,

suppose you have a grid with 2 column, a bool column and a double one.  Also, you have two texbox, on the first show the sum of the double cells only where the bool cell value is true, on the second textbox the same as the first but sum if the cell value if false.

 

i have tried but it does not work. Any idea why?

As attachment the sample project

 

Thank you.

WinCalc winGrid bool columns.zip
Parents
  • 469350
    Suggested Answer
    Offline posted

    The problem is with your "if" function. You are trying perform an 'if' check on the condition that the column reference is true. But a column reference like "[//ultraGrid/Band 0/BOOL_COLUMNS]" refers to the entire column. It does not evaluate each cell in the column. So you are comparing the entire column to a single boolean value and this will never be true. It's not a valid comparison.

    The way to do something like this would be to add an unbound column to the grid with a formula like this:

    "if ([BOOL_COLUMNS], DOUBLE_COLUMN, 0)"

    Then you could sum this unbound column and you would end up with a sum where the value of the boolean column is true.

     

Reply Children
No Data