[comp.databases] Need help w/Informix 4gl forms

bwm@investor.pgh.pa.us (Bruce Miller #307) (02/13/91)

I am working with Informix 4gl v.1.10.00 and need some help with screen
forms.  What I would like to do is to call a screen form using a program
variable rather than calling the form directly.

I have a table with information on an individual and his stock broker (my
clients may be using any one of 40+ different brokers) and in the program
I call up a form that looks like the brokers confirm to make it easy for a
novice to get the required data (i.e. trade date not settlement date etc..).

What I would like to be able to do is:

	open form ml from "pr_ar.broker"
	options input wrap
	display form ml

where pr_ar.broker is a character variable that equals ML for example, and
I have a compiled form called ML.frm.  However, as is obvious the program is
looking for pr_ar.broker not the value to which pr_ar.broker is set equal.

I have tried using "$pr_ar.broker", and a few other things but to no avail.
Looking at the c-code generated hasn't been much help (but then again I
haven't much C programming background - except for reading a few texts)

Any Help/Ideas would be appreciated!
--
Bruce W. Miller		(bwm@investor.pgh.pa.usa)
(412) 471-5320 work
(412) 731-4946 home

lugnut@sequent.UUCP (Don Bolton) (02/14/91)

In article <1991Feb12.220516.242@investor.pgh.pa.us> bwm@investor.pgh.pa.us (Bruce Miller #307) writes:
>I am working with Informix 4gl v.1.10.00 and need some help with screen
>forms.  What I would like to do is to call a screen form using a program
>variable rather than calling the form directly.
>
>I have a table with information on an individual and his stock broker (my
>clients may be using any one of 40+ different brokers) and in the program
>I call up a form that looks like the brokers confirm to make it easy for a
>novice to get the required data (i.e. trade date not settlement date etc..).
>
>What I would like to be able to do is:
>
>	open form ml from "pr_ar.broker"
>	options input wrap
>	display form ml
>
>where pr_ar.broker is a character variable that equals ML for example, and
>I have a compiled form called ML.frm.  However, as is obvious the program is
>looking for pr_ar.broker not the value to which pr_ar.broker is set equal.
>
>I have tried using "$pr_ar.broker", and a few other things but to no avail.
>Looking at the c-code generated hasn't been much help (but then again I
>haven't much C programming background - except for reading a few texts)
>
>Any Help/Ideas would be appreciated!
>--
>Bruce W. Miller		(bwm@investor.pgh.pa.usa)
>(412) 471-5320 work
>(412) 731-4946 home

Create a function to open form, I assume that you are storing some
value in the parent row that will point you to the proper form in
some fashion?

in the open form function build a case on the field used to flag
the desired form,,, Ie: WHEN pawnbroker = "joe" THEN 
			    OPEN FORM "X" FROM "/PATH/formname"
			WHEN pawnbroker = "bill" THEN
			    OPEN FORM "Y" FROM "/PATH/formname"

The sad thing here is that you will have a case to maintain, but
it will do what you ask.

gls@trac2000.ueci.com (Gary Smith) (02/14/91)

In article <53027@sequent.UUCP>, lugnut@sequent.UUCP (Don Bolton) writes:
> In article <1991Feb12.220516.242@investor.pgh.pa.us> bwm@investor.pgh.pa.us (Bruce Miller #307) writes:
> >I am working with Informix 4gl v.1.10.00 and need some help with screen
> >forms.  What I would like to do is to call a screen form using a program
> >variable rather than calling the form directly.

Another way would be to pass the form name on the command line and
when you enter the program get the argument i.e:
				LET pawnbroker = ARG_VAL(1)
Then prepare a statement like
				LET exec_str = "OPEN FORM pawn_form FROM '", pawnbroker, "'"
				PREPARE prep_form from exec_str
				EXECUTE prep_form
And then you can use form pawn_form as a normal form, as if you opened it
with constants.  Any statement can be made that way.

Good Luck!


Gary.


-- 
Gary L. Smith @ UE&C-Catalytic   |||  Reply at:  
                                 |||      UUCP:  ..!uunet!trac2000!gls
Spock - ST IV: "What does it     |||  INTERNET:  gls@trac2000.ueci.com
 mean 'Exact change only' ?"     |||

davek@informix.com (David Kosenko) (02/16/91)

In article <985@trac2000.ueci.com> gls@trac2000.ueci.com (Gary Smith) writes:
>> In article <1991Feb12.220516.242@investor.pgh.pa.us> 
	bwm@investor.pgh.pa.us (Bruce Miller #307) writes:
>> >I am working with Informix 4gl v.1.10.00 and need some help with screen
>> >forms.  What I would like to do is to call a screen form using a program
>> >variable rather than calling the form directly.
>
>Another way would be to pass the form name on the command line and
>when you enter the program get the argument i.e:
>				LET pawnbroker = ARG_VAL(1)
>Then prepare a statement like
>		LET exec_str = "OPEN FORM pawn_form FROM '", pawnbroker, "'"
>		PREPARE prep_form from exec_str
>		EXECUTE prep_form
>And then you can use form pawn_form as a normal form, as if you opened it
>with constants.  Any statement can be made that way.

	Unfortunately, that is not the case (that any statement can be prepared
that way), and in fact this very statement is one of the types that cannot
be prepared.
	As stated in the INFORMIX-4GL 4.0 Reference Manal Volume 2, page 7-190
(page 7-178 in the 2.10 version) the syntax for the PREPARE statement is:

	PREPARE statement-id FROM string-spec

Note 3 on this statement reads:

	The string-spec cannot include any of the following statements:
	CLOSE, DECLARE, EXECUTE, FETCH, LOAD, OPEN, PREPARE, UNLOAD, and
	WHENEVER.

Dave

-- 
Disclaimer: These opinions subject to change without notice.
**************************************************************************
The heart and the mind on a parallel course, never the two shall meet.
						-E. Saliers

lugnut@sequent.UUCP (Don Bolton) (02/19/91)

In article <1991Feb15.174329.8722@informix.com> davek@informix.com (David Kosenko) writes:
>In article <985@trac2000.ueci.com> gls@trac2000.ueci.com (Gary Smith) writes:
>>> In article <1991Feb12.220516.242@investor.pgh.pa.us> 
>	bwm@investor.pgh.pa.us (Bruce Miller #307) writes:
>>> >I am working with Informix 4gl v.1.10.00 and need some help with screen
>>> >forms.  What I would like to do is to call a screen form using a program
>>> >variable rather than calling the form directly.
>>
>>Another way would be to pass the form name on the command line and
>>when you enter the program get the argument i.e:
>>				LET pawnbroker = ARG_VAL(1)
>>Then prepare a statement like
>>		LET exec_str = "OPEN FORM pawn_form FROM '", pawnbroker, "'"
>>		PREPARE prep_form from exec_str
>>		EXECUTE prep_form
>>And then you can use form pawn_form as a normal form, as if you opened it
>>with constants.  Any statement can be made that way.
>
>	Unfortunately, that is not the case (that any statement can be prepared
>that way), and in fact this very statement is one of the types that cannot
>be prepared.
>	As stated in the INFORMIX-4GL 4.0 Reference Manal Volume 2, page 7-190
>(page 7-178 in the 2.10 version) the syntax for the PREPARE statement is:
>
>	PREPARE statement-id FROM string-spec
>
>Note 3 on this statement reads:
>
>	The string-spec cannot include any of the following statements:
>	CLOSE, DECLARE, EXECUTE, FETCH, LOAD, OPEN, PREPARE, UNLOAD, and
>	WHENEVER.
>
>Dave

This limitation becomes frustrating when moving multiple modules from
a developement to a production locale. I could "kill" for being able
to set up *all* relative application PATH information in *ONE* place,
(like GLOBALS). So much else in 4gl lets one do global set up and sub-
sequent refrencing, that it seems to make sense it should be able to
do the same for refrencing a PATH structure....

	"I gave it a thumbs down" Siskal      
	"I agree with him" Ebert
	"I wet my pants" Rex Reed

Don "everyone's a critic" Bolton

Of course the opinions either expressed or implied therein are genuine
lugfodder [tm] and likely bear no resemblence to the opinions of any
said rational beings, and likely not my employer either.