Page 1 of 1

Calculated Fields cause an error...

Posted: 21.08.2006, 10:31
by ckempe
Following Situation: I have a column containing a boolean value (it´s an integer: zero for false, anything else means true). To display it properly I´ve added a calculated field "_Mark" to the TZReadOnlyQuery. It displays an "X" when column "Mark" is not zero or a blank, when zero.
I display those Values in a DBgrid. OnDoubleClick I want to send an update-SQL (that works already) and then simply update the display with modifying the calculated field, because Closing on Re-opening the Query is too slow. But then I get an error: Dataset not in edit or insert mode. (I get a german message - I hope, I translated correctly.)
With ZEOS 6.1.x it worked.

Posted: 21.08.2006, 23:06
by zippo
Hmm... let me understand: You modify a calculated field which value calculation is based on another field. If I understood well, then the problem is already in design of the thing, because:

- You are working with a read-only query.
- How do you know which calculated field has to be calculated and which has been modified?
- Always when modify-ing a query it must be set in dsEdit mode, so the error is quite logical.
- Why not use the .Refresh method - maybe it is faster than clode/open?

Try to not use a read-only query and repeat the thing - maybe it works that way.

Posted: 22.08.2006, 20:26
by ckempe
You are probably right, that the way I took is not 100% correct. But it worked.
I tried .refresh, but there´s no difference to close and open.
I´m just wondering why manupilating if the calculated field works ok within OnCalcFields and not outside...