Re: v13 - Null values
Pat, the reason I am looking to test for 'Null' is I have a utility utl_Is_Empty(->Var_or_Field) --> boolean This utility returns true if the field or var is 'empty', if the value is a default empty value for the field or var type (i.e. text = ""). However, as I mentioned before, something that occurred to me (I have not run into it, personally, yet) was that it is possible that a field (it appears a var is never null), could be Null. The code for utl_is_empty did not check for that situation. I was expecting a there to be a simple command, like Nil() for a pointer, a pointer and get a boolean answer, and there is although the command is not as simple as "Null(->Field-or_var)", the command is 'Is field value Null', and it is a simple command that returns a boolean. However, in my code since I am dealing blindly with a pointer to... something... I have to do a bit more testing. Since utl_is_Empty requires a pointer the following few lines of code were/are needed RESOLVE POINTER($Object_ptr;$Varname;$Table;$Field) If ($Field>0) //this is a field $Is_Empty:=(Is field value Null($Object->)) End if On Sun, 3 Jun 2018 13:40:44 +0100, Pat Bensky via 4D_Tech wrote: > Maybe try something like this: > - Set an error handler > - Try to use that field or variable > - If it is null then the error handler will catch it > > eg: > ON ERR CALL("errorcatcher") > $result:=$BooleanVarOrfield=true > ON ERR CALL("") > > On 2 June 2018 at 15:02, Arnaud de Montard via 4D_Tech <4d_tech@lists.4d.com >> wrote: > >> >>> Le 1 juin 2018 à 20:39, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> >> a écrit : >>> >>> I meant - I was looking for a command which behaved like Nil(), but for >>> Null. >> >> Hi Chip, >> I had a bad recent experience with a legacy db in which check box "convert >> Null to empty" was sometimes on, sometimes off… The use of QUERY command, >> in that situation, is risky: >>//example with date >> QUERY($table_p->;$field_p->=!00/00/!) >> $empty_l:= Records in selection($table_p->) >> QUERY($table_p->;$field_p->#!00/00/!) >> $notEmpty_l:= Records in selection($table_p->) >> ASSERT(Records in table($table_p->)=($empty_l+$notEmpty_l);"data >> integrity or bad Null setting") >> >> It's checked everywhere now. >> >> In a brand new DB, and *knowing what strategy has been adopted about Null >> use*, things could be different. >> >> -- >> Arnaud de Montard >> >> >> >> ** >> 4D Internet Users Group (4D iNUG) >> FAQ: http://lists.4d.com/faqnug.html >> Archive: http://lists.4d.com/archives.html >> Options: https://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ** >> > > > > -- > * > CatBase - Top Dog in Data Publishing > tel: +44 (0) 207 118 7889 > w: http://www.catbase.com > skype: pat.bensky > * > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Null values
Maybe try something like this: - Set an error handler - Try to use that field or variable - If it is null then the error handler will catch it eg: ON ERR CALL("errorcatcher") $result:=$BooleanVarOrfield=true ON ERR CALL("") On 2 June 2018 at 15:02, Arnaud de Montard via 4D_Tech <4d_tech@lists.4d.com > wrote: > > > Le 1 juin 2018 à 20:39, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> > a écrit : > > > > I meant - I was looking for a command which behaved like Nil(), but for > > Null. > > Hi Chip, > I had a bad recent experience with a legacy db in which check box "convert > Null to empty" was sometimes on, sometimes off… The use of QUERY command, > in that situation, is risky: >//example with date > QUERY($table_p->;$field_p->=!00/00/!) > $empty_l:= Records in selection($table_p->) > QUERY($table_p->;$field_p->#!00/00/!) > $notEmpty_l:= Records in selection($table_p->) > ASSERT(Records in table($table_p->)=($empty_l+$notEmpty_l);"data > integrity or bad Null setting") > > It's checked everywhere now. > > In a brand new DB, and *knowing what strategy has been adopted about Null > use*, things could be different. > > -- > Arnaud de Montard > > > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** > -- * CatBase - Top Dog in Data Publishing tel: +44 (0) 207 118 7889 w: http://www.catbase.com skype: pat.bensky * ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Null values
> Le 1 juin 2018 à 20:39, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > I meant - I was looking for a command which behaved like Nil(), but for > Null. Hi Chip, I had a bad recent experience with a legacy db in which check box "convert Null to empty" was sometimes on, sometimes off… The use of QUERY command, in that situation, is risky: //example with date QUERY($table_p->;$field_p->=!00/00/!) $empty_l:= Records in selection($table_p->) QUERY($table_p->;$field_p->#!00/00/!) $notEmpty_l:= Records in selection($table_p->) ASSERT(Records in table($table_p->)=($empty_l+$notEmpty_l);"data integrity or bad Null setting") It's checked everywhere now. In a brand new DB, and *knowing what strategy has been adopted about Null use*, things could be different. -- Arnaud de Montard ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: v13 - Null values
I meant - I was looking for a command which behaved like Nil(), but for Null. :) On Fri, 1 Jun 2018 17:26:26 +, Timothy Penner via 4D_Tech wrote: >> I was looking (in v13) for a boolean test like Nil(). > > Oh yeah, not sure how I missed that. Keep in mind that the Nil > command was renamed to "Is nil pointer" in v16R4 > http://livedoc.4d.com/4D-Language-Reference-13.6/Language/Nil.301-2502515.en.html > http://livedoc.4d.com/4D-Language-Reference-16-R4/Language/Is-nil-pointer.301-3317001.en.html > > > > -Tim > > > > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: v13 - Null values
> I was looking (in v13) for a boolean test like Nil(). Oh yeah, not sure how I missed that. Keep in mind that the Nil command was renamed to "Is nil pointer" in v16R4 http://livedoc.4d.com/4D-Language-Reference-13.6/Language/Nil.301-2502515.en.html http://livedoc.4d.com/4D-Language-Reference-16-R4/Language/Is-nil-pointer.301-3317001.en.html -Tim ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: v13 - Null values
Thanks I was looking (in v13) for a boolean test like Nil(). On Fri, 1 Jun 2018 17:10:32 +, Timothy Penner via 4D_Tech wrote: > Hi Chip, > >> Is there a means to test for a 'Null' value in v13? >> By 'Null' do not mean the default (type appropriate) value of an >> unassigned field or variable. >> If not, at what version does this capability exist? > > In v11 the commands SET FIELD VALUE NULL and IS FIELD VALUE NULL were added: > http://livedoc.4d.com/4D-Language-Reference-13.6/SQL/Is-field-value-Null.301-2502112.en.html > http://livedoc.4d.com/4D-Language-Reference-13.6/SQL/SET-FIELD-VALUE-NULL.301-2502111.en.html > ^ These exist in v13. > > In v17 (v16R4) NULL was introduced as both a data type and a command: > https://blog.4d.com/new-type-supported-by-4d-null/ > http://doc.4d.com/4Dv16R4/4D/16-R4/Null.301-3428288.en.html > http://doc.4d.com/4Dv16R4/4D/16-R4/Data-Types.300-3317960.en.html#3428911 > > Hope that helps, > > -Tim > > > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: v13 - Null values
Hi Chip, > Is there a means to test for a 'Null' value in v13? > By 'Null' do not mean the default (type appropriate) value of an unassigned > field or variable. > If not, at what version does this capability exist? In v11 the commands SET FIELD VALUE NULL and IS FIELD VALUE NULL were added: http://livedoc.4d.com/4D-Language-Reference-13.6/SQL/Is-field-value-Null.301-2502112.en.html http://livedoc.4d.com/4D-Language-Reference-13.6/SQL/SET-FIELD-VALUE-NULL.301-2502111.en.html ^ These exist in v13. In v17 (v16R4) NULL was introduced as both a data type and a command: https://blog.4d.com/new-type-supported-by-4d-null/ http://doc.4d.com/4Dv16R4/4D/16-R4/Null.301-3428288.en.html http://doc.4d.com/4Dv16R4/4D/16-R4/Data-Types.300-3317960.en.html#3428911 Hope that helps, -Tim ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
v13 - Null values
Is there a means to test for a 'Null' value in v13? By 'Null' do not mean the default (type appropriate) value of an unassigned field or variable. If not, at what version does this capability exist? Thanks Chip --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **