• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Grid Lines and errors

amwalshjde

Well Known Member
I am having difficulty with a application I am writing. It is a header
detail. The grid can be populated with many (several hunderd) records. The
user can change data in one field (for example ship quantity). I want (and
have) an error in the grid to indicate that the ship quantity is greater
then the Order quantity. If any (just takes one) of the grid lines has this
error then I want the form exits disabled.

I first tired to the the system value "ERROR Status" but that only gets set
to an error when business functions return a error, or a table IO fails, not
when the set error system function is used. So it was no help. My second
idea was to set a error flag (say ev01) in the "Grid section changed +
exited - inline" to test for the error, and if present set the flag to "1",
else "0". This worked until I had errors on multiple lines. THen as soon
as I fixed one line, the error status became "0" (that controls the system
function to enable the form exits). The only other thing I can think of is
to read every record in the grid each time a grid row is exited. That just
seems like a lot of reading just to see if one line has a problem. If I had
100 grid lines and the user changed 50 of them, I would have to do 5000 grid
line reads...

Anyone have a better idea?

Aaron
B7332 sp 13.1 AS/400 v4r4


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
 

Zoltan_Gyimesi

Legendary Poster
Hi Aaron,

Use the SetGridCellError / ClearGridCellError System Function pair (Grid category).
The best events to use them are:
* Column Exited
* Column Exited and Changed - Inline
* Column Exited and Changed - Asynch
* Row Exited
* Row Exited and Changed - Inline
* Row Exited and Changed - Asynch

All of these events have to be (surely will be) finished before OK processing. OK automatically won't work while just one Error exist although the OK button and OK menu selection won't be grayed out. Pressing OK just won't have any affect.

If the compare value is also in a column and it is updatable then the best choices are the ROW events. It prevent to duplicate your Error setting logic on both fields.

Hope, could help
... and let us know if you have further problem in this issue (or in an other one :)

Zoltán




B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Top