New call-to-action
Results 1 to 25 of 25

Thread: Capitalisation of letters

  1. #1
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default Capitalisation of letters

    Hi

    I have a field containing names. Somes names are "double-barrelled" e.g. Smith-Klein. When the data is entered, it doesn't matter whether the employee enters the names as upper case or lower case, the field rule converts to 1st letter cap, the rest lower case. Which results in Smith-klein.

    How do I tweak my screen form (and reports) so that the K is always upper case after a hyphen?

    Thanks in advance
    Paul

  2. #2
    Member
    Real Name
    Mark Kenworthy
    Join Date
    Feb 2004
    Posts
    7

    Default RE: Capitalisation of letters

    Paul

    I think you just change in the field rules for that field and set Case convert to "Word"

    Mark

  3. #3
    Member Mike Konoff's Avatar
    Real Name
    Mike Konoff
    Join Date
    Apr 2000
    Location
    Illinois
    Posts
    746

    Default RE: Capitalisation of letters

    Mark/Paul,

    A4V6 assumes that the "-" is part of the string as if it's one whole word and will return Smith-klein. I've toyed around and cannot find a simple way to accomplish this.

    Mike

  4. #4
    Member
    Real Name
    Mark Kenworthy
    Join Date
    Feb 2004
    Posts
    7

    Default RE: Capitalisation of letters

    Mike
    It won't do it automaticaly but
    I Tested on mine and you can at least type in Upper or lower
    case and save, it seem to work that way Ok
    Thanks I'm at home now but I'll try again tommorow
    Hey first time on the message board

    over 10 yr user with many applications
    Just upgraded to version 7 yesterday on a network
    Got real good advice off this board
    I felt i owed sombody somthing

    Thanks
    mark

  5. #5
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hi Mark/Mike
    Setting field rules to "Word" won't do it - been there tried that - the only way I can think of doing it is to extract the letters from after the hyphen, use the Case function something like "if 1st letter="a","A"" and then reconstitute the name and tack on the remaining letters. Messy but should work. Although I wonder if I can nest 26 case functions...hmmm...time for the manual again...

    Thanks both...
    Paul

  6. #6
    Member Mike Konoff's Avatar
    Real Name
    Mike Konoff
    Join Date
    Apr 2000
    Location
    Illinois
    Posts
    746

    Default RE: Capitalisation of letters

    Paul,

    You idea of some sort of nested function to change a to A, b to B and so on, came to mind. But I know there is a limit to the amount of text that can be used in a field rule. I suspect there may be more space if this is done in a script.

    That sure would be one long script.

    Mike

  7. #7
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Indeed.
    If I use SUBSTR to select the letter after the hyphen, I can change it to uppercase using a nested CASE function (times 26!), then recombine etc. Seems very convoluted though. There has to be an easier way.

    And now the users tell me that there is a (very rare) need for the letter after the hyphen to actually BE lowercase. Sometimes.
    GRRRRR!

    Time for another coffee and a rethink...
    Thanks for your input, Mike.

    Paul

  8. #8
    Gedi Margaitis
    Guest

    Default RE: Capitalisation of letters

    You could write an Exit Trigger script that could use a combination functions such as *ANY(), ISLOWER(), UPPER(), and LEN() to determine the position of the special character and then, capitalize and re-write it.

    gm

  9. #9
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hadn't thought of that. Another pair of eyes often helps - thank you Gedi.

    It will mean changing the employees' way of working a little, but I will try that route.

    It would perhaps be simpler all round to get them to enter the data in that particular field exactly as they want it to appear in the reports, and remove any field re-formatting altogether. That way they get the capitals exactly where they want them or don't want them.

    Regards
    Paul

  10. #10
    Member
    Real Name
    Mark Kenworthy
    Join Date
    Feb 2004
    Posts
    7

    Default RE: Capitalisation of letters

    Paul

    If you want Alpha to do it I Agree it won't. I also have
    had this at one time come across my plate

    However you mentioned that you couldn't even enter
    Smith-Klien and have it saved without reading Smith-klien

    I just tried it on my computer
    Typed In Smith-Klien saved it and it Read Smith-Klien
    (Case Convert to Word)
    Maybe this is not what you wanted but hope it helps
    Mark

  11. #11
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hi Mark

    Sorry - I wasn't being clear enough. I can enter it the way you say and get the desired result, but for reasons which are probably too boring to be of interest to you right now, the keyboard entry is always done without use of the Shift key. Hence the problem.

    I think I will try to change the way things are done in the office.
    Wish me luck!

    Paul

  12. #12
    Member
    Real Name
    Gary Smith
    Join Date
    Apr 2000
    Posts
    180

    Default RE: Capitalisation of letters

    Create a keystroke script named something like LNAME_VT.
    Edit the field rules and set the Validate trigger to play this LNAME_VT script. The script does a case convert on a last name that contains exactly 1 hyphen. It does nothing if the last name does not contain exactly 1 hyphen. You should still set the case convert field rule to Word. The code contains comments to help you understand what it does. You could also use this code to handle last names like O'Connor, etc. The LNAME_VT script code follows.

    {* LNAME_VT field rule validate trigger *}
    {*·Cancel·if·the·last·name·does·not·contain·1·hyphen·*}
    {IF·OCCURS("-",%SYS_FIELD_VALUE)=0,{{CANCEL}}}
    {IF·OCCURS("-",%SYS_FIELD_VALUE)"1,{{CANCEL}}}
    {*·X·is·the·position·of·the·hyphen·*}
    {SET·%X,AT("-",%SYS_FIELD_VALUE)}
    {*·Y·is·the·length·of·the·word·right·of·the·hyphen·*}
    {SET·%Y,LEN(LTRIM(RTRIM(%SYS_FIELD_VALUE)))-VAL(%X)}
    {*·Convert·the·word·left·of·the·hyphen·*}
    {SET·%NAME1,W_UPPER(LEFT(%SYS_FIELD_VALUE,VAL(%X)-1))}
    {*·Convert·the·word·right·of·the·hyphen·*}
    {SET·%NAME2,W_UPPER(RIGHT(%SYS_FIELD_VALUE,VAL(%Y)))}
    {*·Change·the·value·of·the·user-entered·field·*}
    {SET·%SYS_FIELD_VALUE,%NAME1+"-"+%NAME2}

  13. #13
    Member
    Real Name
    Gary Smith
    Join Date
    Apr 2000
    Posts
    180

    Default RE: Capitalisation of letters

    I expanded the LNAME_VT validation trigger script to handle hyphenated names such as O'Brien and O'Connor. It handles last names such as Smith-Klein, Klein-O'Connor, O'Brien-O'Connor, etc.

  14. #14
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Wow, Gary!
    I knew there were some helpful people here but that's beyond the call of duty - I will test it and apply it to my app.
    Did you already have the code or have you written it specially for lil' ol' me?

    Best regards
    Paul

  15. #15
    Member
    Real Name
    Gary Smith
    Join Date
    Apr 2000
    Posts
    180

    Default RE: Capitalisation of letters

    I wrote it last night. It was a real brain teaser. I hope it works out. Glad to help.

  16. #16
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Well I must say that is really kind of you - thank you.
    Will test it in my app over the weekend and let you know the outcome on Monday.

    Regards
    Paul

  17. #17
    Member
    Real Name
    Mark Kenworthy
    Join Date
    Feb 2004
    Posts
    7

    Default RE: Capitalisation of letters

    Hello Paul
    I give that a WoW too

    Mark

  18. #18
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hi Gary

    I installed your script, made a couple of minor adjustments to my app, and it works like a dream.
    A great BIG thank you for an elegant and efficient solution.
    I have also learned a little more about Alpha's functions by studying your script.

    Best regards
    Paul

  19. #19
    Member Mike Konoff's Avatar
    Real Name
    Mike Konoff
    Join Date
    Apr 2000
    Location
    Illinois
    Posts
    746

    Default RE: Capitalisation of letters

    Hey Paul,

    So, the script searches for "-" and capitalizes the letter immediately to the right?

    thanks,
    Mike

  20. #20
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Yes, but only if there is just one "-".
    It also capitalises the letter to the right of an apostrophe e.g. O'connor becomes O'Connor.
    A good piece of work by Gary.
    Regards
    Paul

  21. #21
    Member
    Real Name
    Gary Smith
    Join Date
    Apr 2000
    Posts
    180

    Default RE: Capitalisation of letters

    I remembered some A5V4 code written by Dr. Peter Wayne a while back that performs more extensive case converts of last names. I modified it to work with A4V6 and A4V8. You can set the case convert field rule to none. The script handles more types of last names that need to be converted, such as those that begin with mc and mac. It handles hyphenated names when it finds exactly 1 hyphen. I tested it and it seems to work well. Give it the once over.

  22. #22
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hi again Gary

    Any idea why LAST_VT works fine with A4v8, but in A4v6 it causes McdOnald (capital O) instead of McDonald? Things like O'Brien and Gary-Smith work fine in either version, it's just the Mc/Mac section that doesn't work properly in v6.

    I know there's a rare issue with blank spaces in scripts (sometimes), so I removed them all but it made no difference, and I can't see anything wrong with the code.

    Have you run it on v6 yourself?

    Kind regards
    Paul

  23. #23
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Hi again Gary

    Any idea why LAST_VT works fine with A4v8, but in A4v6 it causes McdOnald (capital O) instead of McDonald? Things like O'Brien and Gary-Smith work fine in either version, it's just the Mc/Mac section of the script that doesn't work properly in v6, but works well in v8.

    I know there's a rare issue with blank spaces in scripts (sometimes), so I removed them all but it made no difference, and I can't see anything wrong with the code.

    Have you run it on v6 yourself?

    Kind regards
    Paul

  24. #24
    Member
    Real Name
    Gary Smith
    Join Date
    Apr 2000
    Posts
    180

    Default RE: Capitalisation of letters

    I just ran LAST_VT script in versions 6 and 8. McDonald, Mc Donald, MacDonald and Mac Donald all worked.

  25. #25
    Member
    Real Name
    Paul Hudson
    Join Date
    Nov 2002
    Posts
    221

    Default RE: Capitalisation of letters

    Ok, must be my app then, because I tried it on my home machine last night and had the same problem in v6.
    It's not a big problem - I'll just modify the script for the v6 PC.

    Thanks Gary

    Paul

Similar Threads

  1. Letters
    By SteveManton in forum Alpha Five Version 5
    Replies: 5
    Last Post: 11-05-2003, 10:35 PM
  2. Letters
    By Bill Griffin in forum Alpha Five Version 5
    Replies: 0
    Last Post: 07-14-2003, 11:57 AM
  3. Letters
    By Phil Rolf in forum Alpha Five Version 5
    Replies: 2
    Last Post: 07-03-2003, 06:17 AM
  4. 4.5 and letters
    By Nello Panelli in forum Alpha Five Version 4
    Replies: 0
    Last Post: 02-17-2001, 03:26 PM
  5. Letters
    By Aadkins101 in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-23-2000, 06:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •