Board index » delphi » Last name, First name versus First name Last name

Last name, First name versus First name Last name

Hello,
I've always stored names as 'Last name, First name'.
Nowadays I see this field containing 'First name Last name' with no
separator but the space bar.
This does not look nice in a dbGrid, so I want to format the string as 'Last
name, First name', also for the matter of quick searching on Last name.
What is the most efficient code to pick the rightmost word (as is the Last
name) in order to put it back where it belongs - before an comma separator?

Why is it now common to just 'dump' the whole name straightforward into the
field? This must cause a dog slow search for the Last name?
( I know that company names looks strange if peeled apart with a comma
separator, but they are easy to handle separately.)
I mean - private names will be faster and easier to handle in an index if
Last name is the first occurrence ?

any thougts would be appreciated.

--
Kind regards
Kai Inge

{The limit of my Delphi
is my lack of knowledge}

 

Re:Last name, First name versus First name Last name


I have always wondered why names sometimes are stored as "Last name, First
name".
If you want to be able to search for the first name it is easier if it is in
the front.
You could split it up into 3 separate fields containing first name, middle
name and last name.
That way you can search for both the first, middle and last name.

And by the way:
My name is not Tolderlund, Finn.
My name is Finn Tolderlund

Kai Inge Buseth <kibus...@online.no> skrev i en
nyhedsmeddelelse:QThX3.9050$1C4.88...@news1.online.no...

Quote
> Hello,
> I've always stored names as 'Last name, First name'.
> Nowadays I see this field containing 'First name Last name' with no
> separator but the space bar.
> Why is it now common to just 'dump' the whole name straightforward into
the
> field? This must cause a dog slow search for the Last name?
> I mean - private names will be faster and easier to handle in an index if
> Last name is the first occurrence ?

Re:Last name, First name versus First name Last name


Quote
Kai Inge Buseth wrote:

> I've always stored names as 'Last name, First name'.
> Nowadays I see this field containing 'First name Last name' with no
> separator but the space bar.

I don't quite get, what do you mean by seeing that happen? Are you
getting the names in that format from some outside source, and then
you save them in to your database, or what?

Quote
> This does not look nice in a dbGrid, so I want to format the string as 'Last
> name, First name', also for the matter of quick searching on Last name.
> What is the most efficient code to pick the rightmost word (as is the Last
> name) in order to put it back where it belongs - before an comma separator?

Do you want to store the data in to your database in the desired format,  
'Last name, First name'? Or do you only want to see it in DbGrid that way?
If you only want to see it in that way, then the Field's OnGetText event
is the right place to reorganize the text.

Quote
> Why is it now common to just 'dump' the whole name straightforward into the
> field? This must cause a dog slow search for the Last name?
> ( I know that company names looks strange if peeled apart with a comma
> separator, but they are easy to handle separately.)
> I mean - private names will be faster and easier to handle in an index if
> Last name is the first occurrence ?

I wonder what kind of database is that, where the person names are organized
and saved to DB in order 'First name Last name'. I would quess they still
are organized in order 'Last name First name', and then indexed according
to that field.

To make the things easier for users, you can still show the names on screen
in what ever order, or format you wish to.

Markku Nevalainen

Re:Last name, First name versus First name Last name


Hello, and thanks for the answers.
I'm not a professional programmer, but do some programs for customers in
spare time, using Delphi 3 pro and dBase tables.
My latest customer used a DataEase program. The customer-table in this
program has approx four thousand names in the format I mentioned - First
name Last name. In one field. At work, my company use a program called SAP.
It's a huge German developed program. If you want to search for the Last
name, you will have to put an asterisc (*) before the last name in the
search string, to tell the program not to bother with the first name.
Therefore I assume this program also use the format First name Last name,
and thought  this was now a common way to do it.

For my customer I want to extract some data from his previous table into my
programs table.
In fact I would prefer to separate the field content in First and Last name
fields. How do I split the content with the rightmost word as Last name and
the rest of the words as First name?
(Then I can use your advice and format the dbGrid output)

A code snip would be useful here.

Thanks in advance.

--
Kind regards
Buseth, Kai Inge

{The limit of my Delphi
is my lack of knowledge}

Quote
Markku Nevalainen wrote in message <382DC0DC.7...@iki.fi>...
>Kai Inge Buseth wrote:

>I don't quite get, what do you mean by seeing that happen? Are you
>getting the names in that format from some outside source, and then
>you save them in to your database, or what?

>Do you want to store the data in to your database in the desired format,
>'Last name, First name'? Or do you only want to see it in DbGrid that way?
>If you only want to see it in that way, then the Field's OnGetText event
>is the right place to reorganize the text.

>I wonder what kind of database is that, where the person names are
organized
>and saved to DB in order 'First name Last name'. I would quess they still
>are organized in order 'Last name First name', and then indexed according
>to that field.

>To make the things easier for users, you can still show the names on screen
>in what ever order, or format you wish to.

>Markku Nevalainen

Re:Last name, First name versus First name Last name


Quote
Kai Inge Buseth wrote in message ...
>(...snip...)
>My latest customer used a DataEase program. The customer-table in this
>program has approx four thousand names in the format I mentioned -
First
>name Last name. In one field. At work, my company use a program called
SAP.
>It's a huge German developed program. If you want to search for the
Last
>name, you will have to put an asterisc (*) before the last name in the
>search string, to tell the program not to bother with the first name.
>Therefore I assume this program also use the format First name Last
name,
>and thought  this was now a common way to do it.

It is NOT a common way to do it, it's really amateuristic ;-)
No serious database is sorted/indexed/whatever on FIRST name. Never put
first and last name in ONE field, but use different fields: this allows
you to index on whatever you want: lastname, lastname plus firstname,
and so on... (although I don't see any reason to index on _first_ name
in a business application...?)
Quote
>For my customer I want to extract some data from his previous table
into my
>programs table.
>In fact I would prefer to separate the field content in First and Last
name
>fields. How do I split the content with the rightmost word as Last name
and
>the rest of the words as First name?

If every name is of the form First_space_Last, it's easy:
Procedure SplitName(const FullName; var First, Last);
var
  PosSpace: integer;
begin
  PosSpace := pos(' ', FullName);
  if PosSpace > 0 then begin
  First := copy(FullName,1, PosSpace-1);
  Last := copy(FullName, PosSpace+1, length(FullName-PosSpace);
  end
  else begin
    First := FullName;
    Last := '';
  end;
end;
--
Call the procedure as follows:
...
var
  First, Last, Fullname: string;
begin
  ...
  Fullname := ...;
  SplitName(FullName, First, Last);
--
But... this is not the solution to all of your problem: lots of names
are made up of more than two parts, e.g.
John d' Amour, or Philip K.{*word*106}, or Jean Jacques de Laville d'
Alsace...
And what about records with no spaces, by error or on purpose, like:
P.Smith, or no first name: Pettersons?
-------------
Guido,
webmaster DelphiLand: free online Delphi tutorials
http://www.festra.com

Re:Last name, First name versus First name Last name


Finn Tolderlund <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> wrote in
message news:JhjX3.352$d3.4665@news0.mobilixnet.dk...

Quote
> I have always wondered why names sometimes are stored as "Last name, First
> name".

Indexing. Surnames recur far less often than forenames, so an
alphabetical list of
  "surname, forename(s)"
is probably the most easy to navigate, on paper and on screen.

Maybe you know five "Jeremy's", and two "Collins's". If you want
to look me up, you scan down to the "C's", find "Collins", and hey
presto, from a choice of two you find me pretty quickly. It would
take you approximately twice as long to find me in the
  "forename(s), surname"
system.

--
Jeremy Collins
Kansai Business Systems
http://www.kansai.co.uk/

Re:Last name, First name versus First name Last name


Hi,

Isolating the rightmost word is not sufficient; what about people with surnames
such as 'St. John'.  You really need to keep the surname and the given name(s)
separate internally in your application.  How you present them externally to the
user is a different matter.

Rod

Quote
Kai Inge Buseth wrote:
> Hello,
> I've always stored names as 'Last name, First name'.
> Nowadays I see this field containing 'First name Last name' with no
> separator but the space bar.
> This does not look nice in a dbGrid, so I want to format the string as 'Last
> name, First name', also for the matter of quick searching on Last name.
> What is the most efficient code to pick the rightmost word (as is the Last
> name) in order to put it back where it belongs - before an comma separator?

> Why is it now common to just 'dump' the whole name straightforward into the
> field? This must cause a dog slow search for the Last name?
> ( I know that company names looks strange if peeled apart with a comma
> separator, but they are easy to handle separately.)
> I mean - private names will be faster and easier to handle in an index if
> Last name is the first occurrence ?

> any thougts would be appreciated.

> --
> Kind regards
> Kai Inge

> {The limit of my Delphi
> is my lack of knowledge}

Re:Last name, First name versus First name Last name


Hello Rod,

in my application I use a separate field for First, Middle and Last name for
the user input.
The problem is the table the user had before. His table has the whole string
in one field, with no separator but a space, in the previous mentioned
order. Since over four thousand names has to be split up, it has to be done
by code. As you say, it is impossible to know if the middle parts of the
string is a double surname or double/ triple  given name. The closest I get,
is to assume that at least the rightmost word is a surename.

--
Kind regards
Kai Inge

{The limit of my Delphi
is my lack of knowledge}

Quote
Rod Allen wrote in message <382E168B.520AE...@san.rr.com>...
>Hi,

>Isolating the rightmost word is not sufficient; what about people with
surnames
>such as 'St. John'.  You really need to keep the surname and the given
name(s)
>separate internally in your application.  How you present them externally
to the
>user is a different matter.

>Rod

Re:Last name, First name versus First name Last name


Hi,
I forgot to mention that I also use a fourth field, which has the content of
the other three on format 'Surename, Given name'.
It is this field I index and present in a dbGrid. Now I learned from a
previous answer how to format the output of a dbGrid directly. This seem to
be the best way, but haven't tried it yet.

--
Kind regards
Kai Inge

Re:Last name, First name versus First name Last name


Hi !

I'm not arguing against the "lastname, Firstname" form or the
sparate-fields-solution. But: I've been using a few apps where you may
choose "First Last", "Last, First" showing (and sorting). I allways go
for the "First Last". One reason is that I remember a name in the form
"First last". And - when a person introduces himself, he allways uses
this form.

I wonder why we are using the "Last, First"...maybe the habit from
cardex systems & archive files, later reproduced by computer apps ?

Anyway, names should be possible to search by first, last & parts of
both names and a "containing xxx".

--

Bjoerge

Kai Inge Buseth skrev i meldingen ...

Quote
>Hello, and thanks for the answers.
>I'm not a professional programmer, but do some programs for customers
in
>spare time, using Delphi 3 pro and dBase tables.
>My latest customer used a DataEase program. The customer-table in this
>program has approx four thousand names in the format I mentioned -
First
>name Last name. In one field. At work, my company use a program called
SAP.
>It's a huge German developed program. If you want to search for the
Last
>name, you will have to put an asterisc (*) before the last name in the
>search string, to tell the program not to bother with the first name.
>Therefore I assume this program also use the format First name Last
name,
>and thought  this was now a common way to do it.

>For my customer I want to extract some data from his previous table
into my
>programs table.
>In fact I would prefer to separate the field content in First and Last
name
>fields. How do I split the content with the rightmost word as Last name
and
>the rest of the words as First name?
>(Then I can use your advice and format the dbGrid output)

>A code snip would be useful here.

>Thanks in advance.

>--
>Kind regards
>Buseth, Kai Inge

>{The limit of my Delphi
>is my lack of knowledge}
>Markku Nevalainen wrote in message <382DC0DC.7...@iki.fi>...
>>Kai Inge Buseth wrote:

>>I don't quite get, what do you mean by seeing that happen? Are you
>>getting the names in that format from some outside source, and then
>>you save them in to your database, or what?

>>Do you want to store the data in to your database in the desired
format,
>>'Last name, First name'? Or do you only want to see it in DbGrid that
way?
>>If you only want to see it in that way, then the Field's OnGetText
event
>>is the right place to reorganize the text.

>>I wonder what kind of database is that, where the person names are
>organized
>>and saved to DB in order 'First name Last name'. I would quess they
still
>>are organized in order 'Last name First name', and then indexed
according
>>to that field.

>>To make the things easier for users, you can still show the names on
screen
>>in what ever order, or format you wish to.

>>Markku Nevalainen

Re:Last name, First name versus First name Last name


Jeremy Collins <jer...@kansai.co.uk> skrev i en
nyhedsmeddelelse:942539134.17624.0.nnrp-07.c2de6...@news.demon.co.uk...

Quote

> Finn Tolderlund <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> wrote in
> message news:JhjX3.352$d3.4665@news0.mobilixnet.dk...
> > I have always wondered why names sometimes are stored as "Last name,
First
> > name".

> Indexing.

I think you missed my point.
My point was the last lines in my post.

Re:Last name, First name versus First name Last name


Hi,
I think you are right about the habit from cardex etc, but when listing
names in tx a grid - or a telephone book- it's more convenient to use this
format to display the data.
Easier to read, I think.
The "containing xxx" method seems to be used on my customers old table
field, also to find the last name, but must be slower than a clean index
search. Therefore I will try to split it, to get an index on both.
My problem is that I don't know how to handle the pos function when the
separators is just spaces between several words.
I accept the rightmost word as Last name and will put the rest in First name
field.  Perhaps I will have to measure the string and do a test on each
character from right to left, looking for the first space in this direction.

--
Kind regards
Kai Inge

{The limit of my Delphi
is my lack of knowledge}

Quote
Bj?rge S?ther wrote in message ...
>Hi !

>I'm not arguing against the "lastname, Firstname" form or the
>sparate-fields-solution. But: I've been using a few apps where you may
>choose "First Last", "Last, First" showing (and sorting). I allways go
>for the "First Last". One reason is that I remember a name in the form
>"First last". And - when a person introduces himself, he allways uses
>this form.

>I wonder why we are using the "Last, First"...maybe the habit from
>cardex systems & archive files, later reproduced by computer apps ?

>Anyway, names should be possible to search by first, last & parts of
>both names and a "containing xxx".

Re:Last name, First name versus First name Last name


Hi,
and so it should appear in most places, envelopes etc,
but I would rather not find it that way in a thelephone book.
Then it would be a hard job to find your thelephone number :)

--
Kind regards
Kai Inge

{The limit of my Delphi
is my lack of knowledge}

Quote
Finn Tolderlund wrote in message ...

>And by the way:
>My name is not Tolderlund, Finn.
>My name is Finn Tolderlund

Re:Last name, First name versus First name Last name


In article <942539134.17624.0.nnrp-07.c2de6...@news.demon.co.uk>, "Jeremy

Quote
Collins" <jer...@kansai.co.uk> writes:
>Maybe you know five "Jeremy's", and two "Collins's". If you want
>to look me up, you scan down to the "C's", find "Collins", and hey
>presto, from a choice of two you find me pretty quickly. It would
>take you approximately twice as long to find me in the
>  "forename(s), surname"
>system.

Depends entirely on the popularity of the surname and forename - I would
suggest that Collins is actually more popular than Jeremy - but I don't know.

Searching for a name (for final choice by selection) is better done by locating
or indexing on the soundex detivative of the name (remove vowels, vowel-likes,
and repeat consonants).

Alan Lloyd
alangll...@aol.com

Re:Last name, First name versus First name Last name


Finn Tolderlund <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> wrote in
message news:sDwX3.403$d3.5266@news0.mobilixnet.dk...

Quote

> Jeremy Collins <jer...@kansai.co.uk> skrev i en
> nyhedsmeddelelse:942539134.17624.0.nnrp-07.c2de6...@news.demon.co.uk...

> > Finn Tolderlund <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> wrote in
> > message news:JhjX3.352$d3.4665@news0.mobilixnet.dk...
> > > I have always wondered why names sometimes are stored as "Last name,
> First
> > > name".

> > Indexing.

> I think you missed my point.
> My point was the last lines in my post.

Them I'm confused. I don't see how the name is *displayed*
can affect the ability to search the database? Do we agree that
the way data is displayed is a very separate issue to how it is
stored?

--
Jeremy Collins
Kansai Business Systems
http://www.kansai.co.uk/

Go to page: [1] [2]

Other Threads