> I have a variable which holds the name of a field on the current form, > say field_name. I'd like to be able to change the value of the field held in > field_name. What I'd like to do is something like: > > field_name = 'student_num'; /* where student_num is the name of a field */ > :field_name = '1000'; /* set the value of student_num to '1000' */ > > This is an abuse of the 4GL name notation but I hope you see what I mean. > The closest thing I've noticed is that expressions like > 'clear field :field_name' are possible, but I guess this is really just a form > of parameter passing. > > Is there an easy/any way to do this? You could use a 3GL procedure. Here's an example in C: void put_form( const char *form_name , const char *field_name , const char *value ) { #ifdef ARGS_FOR_ESQL exec sql BEGIN declare section ; char *form_name ; char *field_name ; char *value ; exec sql END declare section ; #endif exec frs PUTFORM :form_name ( :field_name = :value ) ; return ; } In your 4GL code: field_name := 'student_num' ; callproc put_form( 'this_form' , field_name , '1000' ) ; You will need to write a separate 3GL procedure for each of the C datatypes: char, long, and double. This should handle all of the standard INGRES datatypes. --Mark Jaeger University of Chicago phone: (312) 702-0328 Graduate School of Business fax: (312) 702-0233 1101 East 58th Street, W309 email: cs_mj@gsbvax.uchicago.edu Chicago, IL 60637-1511, USA (internet)
© William Yuan 2000
Email William