<No Subject Supplied>
Posted in 1993
Jim Gordon replied, > > > 4gl: you CAN do IF a=b THEN ELSE - get the same results > > > > This still does not solve my problem, since in our case NULL should = NULL. > # for those of you who joined the program late. if a=b then > else if A is null and B is null then > else > We tend to prefer things that look a little clearer: IF a=b OR (a IS NULL AND b IS NULL) THEN if-then-else-end_if is one of those magical constructs meant to give maintenance programmers a headache. Yes we should all be able to read code like this easily and fluently, and yes with proper indentation it's not that big a deal, but when you're nested 23 leayers deep.... any additional then/else makes you wonder who it's tied to. > > ----------------------------------------------------------------------------- > > > > WITHOUT NULL INPUT: > > xxxx.per > > > > database xxx WITHOUT NULL INPUT > > > > Results: > > I successfully added a row with NULLs using such a form. > > > > (did I do that one right?) > > > > Try DEFAULT in both the database and/or the form. I never use without > null input it should work but I prefer to ensure that each field is > set to the correct value and that this is immediately visible to > anyone working on the code. > We considered default but determined that, except for some cases were we already do it, we don't want to shove a default on them. If the whole point of Null is that it is an unknown we don't want to put a value in there just because the user didn't know what to put in. This way we can always determine what fields are in exception to our data integirty rules by searching for NULLS. When I said that putting uninitialized fields into a database was poor programming practice - yes that is true, BUT NULL IS a value - it just has a unique meaning. Our error is that we did not appreciate the true inner meaning of the NULL. Now we have seen the light - yea verily we have been born again. j. _____________________________________________________________________________ Jack Parker - Contractor | Hewlett Packard, BSMC Boise, Idaho, USA| If you keep staring at it like that, jparker@hpbs2561.boi.hp.com | your nose is going to grow (208) 396-5388 (W) (208) 384-1623 (H) | into the bark. _____________________________________________________________________________