Brian Dunning's FileMaker Custom Functions

IsEmptyString ( Field )

Use to determine if field is an empty string value.

  Average rating: 4.1 (37 votes) Log in to vote

Ryan Grgurich   Ryan Grgurich
CRS Manufacturing, Inc.
http://www.crsmfg.com

Share on Facebook Share on Twitter

  Sample input:
IsEmptyString ( PhoneNumber::Number )
  Sample output:
1 if field is empty string or empty record, maybe in the last portal row.

0 if field is not an empty string

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Really just a little sugar. Use it to determine if a field is an empty string.

 

Comments

ursus   ursus, neth
Oct 23, 2010
i'm sorry to say that = ""
is NOT the same as isNull
and is NOT the same as
IsEmpty (Although in the last case the result probably will be the same in FMP)
As far as I'm aware there is no way to check for IsNull within FMP
 
Robert Schaub   Robert Schaub, East Hampton, CT
Oct 23, 2010
Is Same as native command IsEmpty(field)
 
Jack Rodgers   Jack Rodgers, Hollywood, FL
Oct 23, 2010
The null character is an actual ascii character, I believe, and not an empty space as between tabs in Filemaker's data.

Usually modern developers who work with a database application think of the null as nothing entered and not as an ascii character used as a place holder.

It was need in old style xbase where a record was fixed length but not in modern databases where tabs or other characters delimite the data and fields can contain little, none, or huge amounts of data.
 
Ryan Grgurich   Ryan Grgurich, Northridge, CA
Oct 23, 2010
Yeah, I think I named this a bit hastily and without a real understanding of what "Null" means. The following links definition wast helpful as well as a quick reference to Learning SQL:

http://databases.about.com/cs/sql/a/aa042803a.htm

It seems Null means unknown value, which is something other than EmptyString or 0 which are known things. I suppose I should change the name to EmptyString() - although the context in which it is sometimes used may be considered implicitly unknown.

Also as far as I can tell IsEmpty() returns 1 for an empty string only if the target field belongs to layouts table. This is why the need to code SomeField = "" arises when setting conditions for related fields on a layout. Unless I'm missing something.

I think it would be possible to use the NULL value in filemaker, you would just have to explicitly use it in fields and define functions for it. Say if you set unknown values of certain attributes in a record to NULL by default then made an IsNull function stating SomeField = "NULL".

Wow, this is quite an active list, thanks for the quick replies. They really helped me do what I should have in first place - lookup what the hell I'm writing about before I write it.

Finally since ="" is shorter than EmptyString () or even ES() there really is no need for this. But I have a sweet tooth so I'll go with EmptyString() since were already here.
 
Ryan Grgurich   Ryan Grgurich, Northridge, CA
Oct 23, 2010
Changing name to IsEmptyString().
 
Daniel Wood   Daniel Wood, Digital Fusion Ltd
Oct 24, 2010
Bit of a waste of a CF, isEmpty does what you want. And you are wrong in saying that isEmpty only works on fields that are on the base context of your layout - isEmpty works though relationships as well - that is why the isEmpty function is actually a great test of whether a record exists though a relationship. If no record exists though a relationship, it will return false, for example:

isEmpty ( relatedField:PrimaryKey )

if that returns 0, no record, if it returns 1, there is a record (assuming primary key always has a value in it).

If you are testing a related field, where there IS a record, but the field itself is just empty, it's still going to return 1/0 , but unfortunately you cannot know if it is returning false because there is no record, or because there is a record, but the field is empty.

As far as I can tell, your function suffers the same issue for related field checking, it's basically just exactly the same as isEmpty, which means to make the function any use, you would need to shorten the name, no point having a function that actually adds more work having to type it in.
 
Matt Petrowsky   Matt Petrowsky, Murieta, CA
Oct 24, 2010
I opt to use an empty CF and call it Null. This makes code easier to read.


Table::Field = Null

http://filemakerstandards.org/display/cs/Empty+strings+%28null+values%29
 
Ryan Grgurich   Ryan Grgurich, Northridge, CA
Oct 25, 2010
Table::Field = "", returns 1 for an empty related record in a portal. IsEmpty(Table::Field) returns 0 for an empty record in a portal. I suppose I could just use, not IsEmpty(Table::Field) to get a 1.
 
beowulf   beowulf, Santa Clara, CA
Oct 25, 2010
IsEmpyt() and your own custom function have nothing to do with checking for an empty *record*. They check for an empty field. If IsEmpty( Table::Field ) returns 0 (false), then that means that the "Field" field in the related record of the "Table" table occurrence *is not* empty. Getting "not IsEmpty()" for a field that contains a value would return false, not 1.

In order to check for an empty *record*, your function would need to check every field of a given record. That could potentially be useful, but probably not very practical to implement.
 
beowulf   beowulf, Santa Clara, CA
Oct 25, 2010
I screwed up the "not IsEmpty()" explanation. It would return 1 for a field that contains a value.
 
Ryan Grgurich   Ryan Grgurich, Northridge, CA
Oct 26, 2010
I all ways auto generate UUID for every record, so checking for these lets me know if a record exist or not.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.