Re: Is polling within an INPUT statement possible?
Posted in 1996
Peter B. Olson (pbolson@intergate.bc.ca) wrote: : I am using Informix 5.0SE on an RS-6000 to develop an application : that automatically weights boxes put on a scale. The program : calls a C function to poll a weight scale until the : motion sensor says that the box weight has settled. The weight : is then returned to the Informix program which then updates a table : and then returns to scale the next box. I see no reason why this shouldn't work. You do have to write a C function that does the polling of the scale and returns the weight value. Then from within your INPUT statement (I assume you mean 4GL), you could do the following: INPUT ..... ... ON KEY (F10) ### OR ANY OTHER KEYSTROKE YOU WANT IF infield(weight_field) CALL scale_polling_function() RETURNING weight_value IF weight_value < 0 THEN ### RETURN NEG. VALUE AS ERRORCODE ERROR "A WEIGHING ERROR HAS OCCURED" ELSE DISPLAY weight_value TO weight_field END IF END IF ... END INPUT Of course, you could also call scale_polling_function inside a BEFORE FIELD section or something else, whatever suits your needs best. As for the calling conventions for C functions inside 4GL programs, look up the 4GL reference manual, they are explained there in great detail. Hope this helps, Richard -- +----------------------------+-------------------------------------------+ | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3413 | | Klinikum Grosshadern | FAX : +49-89-7095-8886 | | 81366 Munich, Germany | | +----------------------------+-------------------------------------------+