Re: Array row field by field
Posted in 1994
Reply to: RE>Array row field by field va >Date: 8/12/94 8:42 AM >From: GeorgeT. Harris > >A colleague of mine has been unable to find a decent method of validating >an array row in situations where field by field validation would impair >user input (i.e. complex cross validation of various fields which may be >entered out of order). The following (desirable!) code fragment does not >work: > > input array ... > after row > perform validation > if validation fails, issue err msg & next field XYZ > if not, change database records > end input > >The problem is that the 'next field' statement moves the cursor to the >XYZ field ON THE ROW AFTER THE ONE WITH THE ERROR. The only time I >can validate is after the user (attempts) to leave the row, but 'after row' >seems to be too late. I can't find a way to back up a row. 'After insert' >would only cover new rows and I need to worry about updating old rows >too. How about 'before after row', Informix? > >I am working on a real kludge that uses an invisible noentry field >(dummy) at the end of each array row. The input array is put in a while >loop. When an error is detected, the row number is stored, and I leave >and re-enter the input array. The before row section performs 'next field >dummy' to force the cursor to the next row until it makes it back to the >original row with the error. Boo - Hiss - Hiss! This causes terrible >scrolling, especially on lower speed terminals, never mind how rotten it >makes the code look! > >Does anyone have a (reasonably) clean way of performing this type of >validation? backing up a row during an input array? > >Please reply -> gth@litle.com and I will summarize responses if there is >sufficient interest. > >Thanks in advance, > >gth@litle.com >Litle & Co. >54 Stiles Road, >Salem, NH, 03079 George, Can you use the NEXT FIELD PREVIOUS command? This will move the cursor to your previous field. Maybe you can execute this by the number of fields you have to get back to the beginning of the line. input array ... after row perform validation if validation fails next field previous (x # of fields on row) issue err msg & next field XYZ if not, change database records end input It seems like their should be a more obvious solution, however I can't think of one. Dave Mascorro dave@oncology.uthscsa.edu The University of Texas Health Science Center at San Antonio