Calculated Fields cause an error...

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ckempe
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 11.07.2006, 11:30

Calculated Fields cause an error...

Post 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.
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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.
ckempe
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 11.07.2006, 11:30

Post 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...
Post Reply