dbTalk Databases Forums  

Validation

comp.databases.filemaker comp.databases.filemaker


Discuss Validation in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
d-42
 
Posts: n/a

Default Re: Validation - 04-15-2007 , 06:50 PM







Yes, I've read the help as well, and indeed did so just prior to
posting. You'll note it doesn't actually come out and say that it
returns 0 when there is a relationship defined on tables that can be
found, fields that haven't been deleted, but no related records.

Quote:
The cCount has the disadvantage it does not return 0 when there are no
related records, but returns empty. (at least in my v8.5 adv). You have
to
build a wrapper to return a 1 or 0. I observed this some time ago and
even
built a testfile to recreate this.

Are you sure, in my experience count returns 0 when there are no
related records with only one exception: that its defined in a calc
field with "do not evaluate if all related fields are empty" (in which
case its blank)

Yes I am very sure. I have built a testfile. Create two tables with a
relation. Two related records and one not related.

For the related record
cCount < Number ; Count ( Related::rel) > returns 2
cIsempty < Number ; IsEmpty ( Related::rel) > returns 0 (False)
cIsvalid < Number ; IsValid ( Related::rel) > returns 1 (True)

For the not related record
cCount returns nothing (Empty)
cIsempty returns 1 (True)
cIsvalid returns 0 (False)
Actually cCount returns 0 for the not related record, unless I checked
off the do not evaluate if all referenced fields are empty. It did
this even if the calc was defined as a text field. (So it wasn't
simply converting 'empty' to 0.)

It only came back empty if it was set not to evaluate at all.

As for isValid I found that it worked as you said in my test db.

But I'm still not convinced, I'll swear IsValid has come back with a 1
even when there were no related records in real world databases I've
worked on, I can't create an example right now, but I was burnt by it
a couple times, which is why I never use it.

Quote:
I would not evaluate empty as "" but use the function IsEmpty
Fair enough. But can someone refresh my memory where the two
expressions yield different results? I seem to recall there actually
is a case...

(x = "") vs (IsEmpty(x))

When do they not evaluate the same?

Quote:
if ( IsEmpty ( count ( Related::rel ) ) ; 0 ; 1 )
which would return a 0 (False) when the relation returnd an empty count. And
although filemaker does evaluate an empty as false, I would prefer to see
something that can be evaluated. a 0 or False. Partly because I have people
who use my databases and sometimes want to change minor things. 0 or 1 I can
explain, but I fear an empty is a step to far. I already hear me explaining:
No an empty is not nothing, zero is nothing. But in this case the zero is a
false and not nothing...... No thanks.
I understand and even agree with your reasoning to coerce true-false
into the neat set of {1,0}. But Its a requirement strictly imposed by
you, not filemaker. FM is quite content to assign true or false to
arbitrary numbers and strings in a consistent and understandable way;
though perhaps perhaps not as understandable and simple as: (0=false,
1=true, there are no other cases)

cheers,
Dave



Reply With Quote
  #12  
Old   
Ursus
 
Posts: n/a

Default Re: Validation - 04-16-2007 , 03:48 AM






Quote:
But can someone refresh my memory where the two
expressions yield different results? I seem to recall there actually
is a case...

(x = "") vs (IsEmpty(x))
===============

I don't know that, but I do know that a space in a field might visualy
evaluate as empty when actualy it is not.

There might technicaly be a difference between ="" and IsEmpty(x) but I
don't think Filemaker does care. But i'm interested if there might be such a
case, if only for my further knowledge of filemaker.

Further you are quite right when you stated: Actually cCount returns 0 for
the not related record, unless I checked
off the do not evaluate if all referenced fields are empty.

I just hadn't turned the checkbox off.

Keep well, Ursus




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.