2 Replies Latest reply on May 23, 2012 4:43 PM by thosliot

    Error Checking During Name Entry

    SteveShiver

      Hi All,

       

      Think of this as a survey .

       

      How many of you have ever implemented an error-checking mechanism for ensuring that a user enters a name suffix into your NameSuffix field (as opposed to entering the suffix as part of the NameLast field) ?

       

      If yes, please share your technique? All comments are welcome...

       

      Steve Shiver

        • 1. Re: Error Checking During Name Entry
          Stephen Huston

          One method is to determine exactly what you consider suffix data to include, and then do a test on the LastName field to see if it meets both of these conditions:

          1. Word count of the LastName field is >=2, AND
          2. [multiple tests for each of your designated: PatternCount ( LastName ; " Jr" )  OR ... etc.

          Be sure you include the space before the suffix inside the quoted test text so it will only match when the pattern count text is after the first word of the LastName.

           

          The main limitation of this method is that you must define your list of possible suffixes by testing for each of them within the OR section of the calculated test.

           

          Then, if you get a match, depending on whether you are using an onExit field script trigger, or field definition validation, you can try to force the user to correct it.

          • 2. Re: Error Checking During Name Entry
            thosliot

            Steve,

             

            I've never had to do this, but a technique springs to mind

             

            For simplicity I shall assume that all suffixes are a single word and that you only looking for them as the last word of the last name field (if this is not the case the technique can be adapted)

             

            so we're interested in Rightwords ( lastName ; 1 )

             

            put all your possible suffixes in a carriage return delimited list: "Jr¶Jnr¶Sr¶Snr… "

             

            then use FilterValues to see if the one exists in the other, thus:

             

            Let ([

                 lastWord = RightWords ( lastName ; 1 ) ;

                 suffixList = "Jr¶Jnr¶Sr¶Snr… " ;

                 foundSuffix = FilterValues ( lastWord ; suffixList )

                 ] ;

                 ( WordCount ( lastName ) >= 2 ) and not IsEmpty ( foundSuffix )

                 )

             

            will return a boolean; if you prefer to know the offending suffix, change the last line to:

             

                 If ( WordCount ( lastName ) >= 2 ; foundSuffix )

             

            cheers

             

            Tom