Re: 4GL Input Array Questions
Posted in 1998
Dennis Pimple wrote: > > Ph. Chantry wrote in message <72gp00$ac2$1@platane.wanadoo.fr>... > >>> Tony Marasco wrote: > >>> > A colleague and I were discussing if it is possible to > >>> > programmatically go to specific rows while in an INPUT ARRAY > >>> > statement. We could not find anything in the books and > >>> > he has taken several Informix classes with no mention of this. > >>> > NEXT FIELD works fine for columns, but the current row only. > >>> > > >>> > Can this be done in 4GL? > >>> > >>> Yes, but it is painful enough that I'd never do it. > >>> > > There are numerous examples of this sort of thing in the faq. In short, it's > relatively simple to move to a row below the current one. You need the last > field in the screen record to be NOENTRY in the perform screen (either list > one that is NOENTRY anyway, or create a specific char(1) field for this > effect). In the 4gl code, a NEXT FIELD statement to this field will take you > to the next row. > > Moving to a row above the current one is a little trickier, but it uses the > same scheme. The problem is you have to leave the INPUT ARRAY and loop back > up to it. Briefly, the code looks like this: > > LET siGoTo = 1 > WHILE siGoTo > 0 > CALL set_count(...) > INPUT ARRAY ... > BEFORE ROW > LET siArrCurr = arr_curr() > IF siGoTo > siArrCurr THEN > # we're supposed to go to a row below this one > NEXT FIELD ne > END IF > LET siGoTo = 0 > # END BEFORE ROW > ON KEY (CONTROL-T) > # go to row #1 > LET siGoTo = 1 > EXIT INPUT > # END ON KEY (CONTROL-T) > ON KEY (CONTROL-B) > # go to last row > LET siGoTo = arr_count() > NEXT FIELD ne > # END ON KEY (CONTROL-B) > # END INPUT ARRAY > END WHILE # siGoTo > 0 I regard this as sufficiently painful that I won't code it. > D4GL eliminates all this; there's a specific directive to put > your user into the desired row at the desired screen line > (right, Jonathan?). Yes. There's a function to do exactly that. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>