Jump to content
Server Maintenance This Week. ×

Displaying customized name in a field


This topic is 7029 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hello,

I'm a bit new to FileMaker and I've come to a situation where I have a Name field for entering a person's full name. However, if in case there is a name too long, FM seems to cut it off when viewing that field in browse mode. However once you click inside the Name field you see the whole name.

My main question is, how can I have my database take a full name and perhaps display it in the name field as (first initial of first name and then full last name?). For example take a long name like Richard Blahblahblahman and have it displayed as R. Blahblahblahman.

Thanks for any help!

Link to comment
Share on other sites

This can be accomplished with a short tidy calculation.

Create a calculation field to be used for display purposes on your layout. You will not be able to enter data in this field, so if your input field must reside on the same layout as this display field, make sure the display calculation field is locked and covers the top of the input field.

If you want to just display all names in an abbreviated manner simply use this calculation example:

(Assuming your field name is called "fullname")

left(leftwords(fullname,1),1) & ". " & middle(fullname , length(leftwords(fullname,1) + 2), length(fullname))

The above calculation simply grabs the first character of the first word and adds a "." and a space after it. It then displays the remainder of the name field by determining the starting character number of the next word in the fullname field and displays the name starting from that character number through to the last character number.

You can also make it conditional on how it displays the name so that it will only do this for names that are considered too long. For this example I'm using 30 characters as the number to decide if a name needs to be abbreviated. So if a name is longer than 30 characters, it will abbreviate it.

Example:

if( Length(fullname) > 30 ,

left(leftwords(fullname,1),1) & ". " & middle(fullname , length(leftwords(fullname,1) + 2), length(fullname))

, fullname)

Hope this helps!

Link to comment
Share on other sites

  • Newbies

Thanks for the help Brian! Yes, I just began learning the basics of design and layouts. Now I need to dive into calculations and all. Thanks for the input and it's exactly what I needed to continue in my database.

-ndz

Link to comment
Share on other sites

Here's a new way to look at this, as I have learned over time. Think the other way - collect each part of the name separately: LastName, FirstName, MiddleName, Suffix (Jr, III, etc.). Then you can use calculation fields to display the name any way you want to AND it allows sorting by any one of the name elements (sort by LastName or sort by FirstName).

Any of my databases now are separated out in this fashion. I had too many times where trying to parse out names from a single field bit me in the butt. What about someone that has only a single legal name (like "Cher"). What about multi-word last names (de Jesus or Vande Kamp or Vander Wahl) or hyphenated last names or first names (Julie Anna or Rose Mary).

Here would be the calculation to show the Last Name, First Name and Middle Initial:

Case(not IsEmpty(NameLast), NameLast) & Case(not IsEmpty(NameFirst), ", " & NameFirst ) & Case(not IsEmpty(NameMI), " " & NameMI )

First Name, Middle Initial, Last Name:

Case(not IsEmpty(NameFirst), NameFirst & " ") & Case(not IsEmpty(NameMI), left(NameMI,1) & ". " ) & Case(not IsEmpty(NameLast), NameLast)

In other words, it's easier to concatenate from separate fields with some conditional calcuations that it is to parse out using BrianC's solution.

Link to comment
Share on other sites

Your first calc produces a few odd results, depending on which field(s) are empty. This one seems to be more reliable.

NameLast & Case( not (IsEmpty(NameLast) or IsEmpty(NameFirst & NameMI)), ", " ) & NameFirst & Case( not (IsEmpty(NameFirst) or IsEmpty(NameMI)), " " ) & NameMI

For your second one, move the space after the period to the last Case.

... & Case( not IsEmpty(NameLast), " " & NameLast )

so that there is no space after the middle initial when NameLast is empty. Of course, this is nitpicking since you should not have a middle name without a last name, or so one would hope.

Link to comment
Share on other sites

This topic is 7029 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.