Normal Topic First-letter capitalization (Read 1274 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
First-letter capitalization
Aug 8th, 2007 at 7:46pm
Print Post Print Post  
Is there a property element selection that sets a text element so that its first letter will always be capitalized?

I've cobbled together this programming that does the trick, but I'm hoping there's a cleaner way.
Code
Select All
On-element-change

var vFirstLetter as string

// Capitalizes the first letter of the Last Name

vFirstLetter = @Left(LastName, 1)
vFirstLetter = ToUpper(vFirstLetter)
LastName = @REPLFIR(LastName, vFirstLetter, vFirstLetter) 

  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: First-letter capitalization
Reply #1 - Aug 8th, 2007 at 7:58pm
Print Post Print Post  
Format->Custom->Initial Caps.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: First-letter capitalization
Reply #2 - Aug 8th, 2007 at 8:01pm
Print Post Print Post  
Super, super, thanks muchly (at least I got some programming practice, hey?)
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: First-letter capitalization
Reply #3 - Aug 8th, 2007 at 8:07pm
Print Post Print Post  
This is interesting: I applied the format to my Firstname and Lastname fields, and it worked perfectly.  However, the FullName field, which uses programming to combine those two, shows the lower case values I typed in.  So it seems that although FirstName and LastName display initial caps, the values are still stored as lower case.  Or have I misunderstood what is happening?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: First-letter capitalization
Reply #4 - Aug 8th, 2007 at 8:16pm
Print Post Print Post  
Infinity wrote on Aug 8th, 2007 at 8:07pm:
This is interesting: I applied the format to my Firstname and Lastname fields, and it worked perfectly.  However, the FullName field, which uses programming to combine those two, shows the lower case values I typed in.  So it seems that although FirstName and LastName display initial caps, the values are still stored as lower case.  Or have I misunderstood what is happening?

Nope. That's what is happening. Just as a date stored as YYYY/MM/DD can be displayed to you in different formats, the same applies to text.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: First-letter capitalization
Reply #5 - Aug 8th, 2007 at 8:20pm
Print Post Print Post  
Thank you.
  

**
Captain Infinity
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: First-letter capitalization
Reply #6 - Aug 8th, 2007 at 9:03pm
Print Post Print Post  
Infinity,

I know there are many ways to do what you want with Sesame but here is one more example for reference purposes, a generic subroutine that will capitalize multiple words.

Subroutine MultInitCaps()
// Multiple Words in Data
var vSpaces as String
var vTemp as String
var vTempBuild as String
var n as Int
ThisElement = ToUpper(@Left(ThisElement, 1)) +
@Mid(ThisElement, 2, @Len(ThisElement) - 1)
vSpaces = @Replace(ThisElement, " ",";")
If @Instr(vSpaces, ";") > 0
{
For n = 1 to @CountStringArray(vSpaces)
vTemp = @AccessStringArray(vSpaces, n)
vTemp = ToUpper(@Left(vTemp, 1)) + @Mid(vTemp,
2, @Len(vTemp)-1)
If n = 1
{
vTempBuild = vTemp
}
Else
{
vTempBuild = vTempBuild + " " + vTemp
}
Next
ThisElement = vTempBuild
}
End Subroutine
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: First-letter capitalization
Reply #7 - Aug 9th, 2007 at 12:38pm
Print Post Print Post  
Thanks Robert, I'll make use of that!
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: First-letter capitalization
Reply #8 - Aug 9th, 2007 at 12:54pm
Print Post Print Post  
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged