Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

@Name question 1

Status
Not open for further replies.

ABOzIT

IS-IT--Management
May 1, 2003
226
0
0
JP
Hi all.

I have an application that welcomes the user by using their first name in a welcome message. I use the following formula to extract their first name from their username:

@Left(@Name([CN];@Username);" ")

The problem I have now is that someone has joined our company with a two word firstname. Now the formula only returns the first word of her firstname which she does not like. I have been able to manipulate the formula to return both words of her first name but then this does not work for everyone else.

I've tried using @Name([G];@Username) which according to designer help will return the "given" name but it doesn't seem to work.

Anyone with any ideas?

Thanks!
 
That will give me the Common Name (CN) ie firstname / initial / last name of the user name. It strips of the hierarchical infomation

I only want the first name.

As you can see in my formula I'm getting the common name and taking everything to the left of the first space. This works fine for people who only have one word in their firstname. If someone has two words (like Sue Ann) this does not work. In this case you would get Sue. I'm trying to find a way of coping with the two different senarios.

Cheers!
 
Instead of @left, use @leftback. Supposing that nobody has two last names seperated by a space, that means that @leftback will get the first space from the right, and take everything to the left of that.

Pascal.
 
Thanks Pascal, your sugestion went part of the way but has prompted me how to solve the issue.

Because we use the middle initial in our user names I had to do a double take using the @LeftBack to get past 2 spaces using the following:

fname:=@LeftBack(@Name([CN];@UserName);" ");
@LeftBack(fname;" ")

Funny, sometime you can't see the wood for the trees!!

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top