Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Simple isempty Statement


Ron

Recommended Posts

Hi Guys,

I have a calculation which displays the company name. The calculation will look if the Company_name field is empty. if it is I would like to concatenate the first_name and last_name in its place.

 

Thank you for your help

Link to comment
Share on other sites

Robert is right on the nail (Hi Chopper!).

 

But Ron, what if the first_name or last_name (or both) fields are also empty? crazy.gifwink.gif

Link to comment
Share on other sites

Hi Ray,

 

I can't imagine that you would not have thought of this one:

 

Code:


Case(

not IsEmpty(company_name);

company_name;

Case(

not IsEmpty(Trim(first_name & " " & last_name));

Trim(first_name&" "&last_name);

"person and organization unknown"

)

)


 

 

But I say stick with Chopper's, that one's simple.... laugh.gif

 

kjoe

Link to comment
Share on other sites

Hi Kjoe,

Well, were I proposing that, I would likely cast it along the lines of:

 

Code:


Case(

IsEmpty(company_name & first_name & last_name); "-unknown-";

IsEmpty(company_name); Trim(first_name & " " & last_name);

company_name

)


- however what's at issue here is what Ron actually *wants* to happen in the event that all three fields are blank. I'm not sure if he's considered that case - but if so, he's not indicated how he would want to deal with it.

 

It may be that if all three fields are empty then the preferred result would be a null. It may be that the preferred result would be a default value (such as your formula or mine above would return). Or it may be that the preferred value would be a reference to some other field. But my point (and my concern here) was that Chopper's formula would not return any of these, but instead would return a lone space.

 

It may be of no consequence, but I figure it does no harm to ask the question... wink.gif

Link to comment
Share on other sites

If we are striving for perfection, IsEmpty() is redundant here.

 

Case(

Company_name ; Company_name ;

first_name & " " & last_name

)

 

will do the job.

Link to comment
Share on other sites

Hello Comment,

I am afraid you are mistaken. IsEmpty( ) is not redundant.

 

In the expression you have suggested, the company name will only be returned if the company name resolves as a non-zero integer. This is because FileMaker evaluates boolean logic numerically with zero and empty (including non-numeric) values evaluating as false.

 

Since the company name will frequently be text-only and will therefore not provide a net numeric value, the test you are suggesting will fail in most cases. Among the few exceptions to this would be company names starting with 't' or 'y' which, in FileMaker 6 and earlier will evaluate as Yes/True. But in FileMaker 7 even these exceptions will not apply (the behaviour of Booleans in this respect has changed in v7).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use