Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!ucbvax!ucsfcgl!cca.ucsf.edu!daedalus!brianc From: brianc@daedalus (Brian Colfer) Newsgroups: comp.databases Subject: Re: Informix 4gl - form input default broken Message-ID: <1362@ucsfcca.ucsf.edu> Date: 19 Sep 88 16:58:12 GMT References: <473@pan.UUCP> Sender: root@cca.ucsf.edu Reply-To: brianc@daedalus.UUCP (Brian Colfer) Organization: UCSF Dept. of Lab Med Lines: 75 In article <473@pan.UUCP> jw@pan.UUCP (Jamie Watson) writes: > >Using the *identical* form with the Informix-SQL Perform form processor >everything works correctly. There are a number of important differences between SQL and 4GL forms... > >In fact what is apparently happening is that the field is getting a null >value by default, instead of a space, because adding null to the include >list causes the form to accept the default value under 4gl. I think you're right about this being a problem, that is, always converting a char column with only spaces to NULL. It is obvious why Informix did this but it would be nice to override the effect. I wonder what the WITHOUT NULL INPUT feature described on page R3-26. I now do ALL my data checking and defaulting in my INPUT section to be consistent and to gain the option for finer control. For thoes unfamiliar with 4gl this is what I mean: Form testing method: # screen . . . f1 = table_test.col_one, include= ("Y","N"," "), default= " ", upshift; #or . . . f1 = table_test.col_one, include= ("Y","N",NULL), upshift; # Null is not needed because the database defaults empty columns # to NULL anyways ------- # 4gl modual . . . INPUT BY NAME table_test.* ------------------------------------------- I would do the following: # screen . . . f1 = table_test.col_one,upshift; -------- INPUT BY NAME table_test.* AFTER col_one If ( pr_tbl_test.col_one != "Y" OR pr_tbl_test.col_one != "N" OR pr_tbl_test.col_one IS NOT NULL ) THEN ERROR " Not a valid value: Please enter Y, N or leave blank" END IF #and if you want col_one to be " " and not a NULL If ( pr_tbl_test.col_one IS NULL ) THEN LET pr_tbl_test.col_one = " " END IF END INPUT Now use pr_tbl_test.col_one as the value for your insert statement. Hope this helps... =============================================================================== Brian : UC San Francisco :...!{ucbvax,uunet}!daedalus.ucsf.edu!brianc Colfer : Dept. of Lab. Medicine : brianc@daedalus.ucsf.edu : PH. 415-476-2325 : BRIANC@UCSFCCA.BITNET ===============================================================================