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/0000!)
>>  $empty_l:= Records in selection($table_p->)
>>  QUERY($table_p->;$field_p->#!00/00/0000!)
>>  $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
**********************************************************************

Reply via email to