Skip to Content
avatar image
Former Member

Validation Rule for the Postal Code Format?

Hi,

Could anybody provide the validation rules for the following formats?

1 <u>Postal code :</u>

Format of Postal Code or PO Box Postal Code needs to be 9999 XX (4 digits + space + 2 characters)

2 <u>Email address:</u>

Validate the Email format

3 Check the numeric Only

4 Check the character only

5 specific value check

IF(TYPE = s, "enter the street only")

is it possible to give the my own error message like "enter the street only"

Looking for the answers.

Best Regards

Devaraj PK

<b>Points will be given for the relevant answers.</b>

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Nov 01, 2007 at 05:52 PM

    Hi Devaraj,

    1) Postal Code :

    ===========

    You have to follow the steps like below

    1) Find the Length of Postal code which is 7

    2) Check the 5 one is Space

    3) Check is there any characters in for the 6 and 7

    4) Also check is there any character for the positions 1 to 4.

    Sample code like below and please expand.

    IF(LEN(POSTAL_CODE)=7,FALSE

    IF(LEN(LEFT(POSTAL_CODE,FIND(POSTAL_CODE," ")-3))=7,TRUE

    IF(LEN(LEFT(POSTAL_CODE,HAS ANY CHARS(POSTAL_CODE)-3)) =7

    IF(LEN(RIGHT(POSTAL_CODE,HAS ANY CHARS(POSTAL_CODE(-4))=7),TRUE,FALSE))))

    2 Email address:

    ============

    Please follow the above steps for validating the EMAIL Address.

    3)Check the character only

    ====================

    Function HAS ALL CHAR will help you.

    5) specific value check

    ================

    IF(TYPE="'S" AND IS NOT NULL (STREET_NAME) AND IS NULL(STREET1) AND IS NULL(STREET),TRUE,FALSE))

    If the error message ,enter stree name only

    Please let me know if you need any more information on Validations.

    Thanks

    Ganesh Kotti

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ganesh Kotti,

      IF(LEN(POSTAL_CODE)=7,FALSE

      IF(LEN(LEFT(POSTAL_CODE,FIND(POSTAL_CODE," ")-3))=7,TRUE

      IF(LEN(LEFT(POSTAL_CODE,HAS ANY CHARS(POSTAL_CODE)-3)) =7

      IF(LEN(RIGHT(POSTAL_CODE,HAS ANY CHARS(POSTAL_CODE(-4))=7),TRUE,FALSE))))

      It gives the syntax Error....

      2.Function HAS ALL CHAR will help you.

      I just tried this but i could get the proper validation!!

      3.How to validate only number???

      4.Do you have any idea on Concate()

      Best Regards

      Devaraj PK

  • avatar image
    Former Member
    Nov 06, 2007 at 07:36 PM

    Hi Devaraj,

    I gave you the sample code and am not checked whether it has syntax error or not..You can develop based on the code .

    As of i know we can't check whether the value is number or not...We have only HAS ANY CHAR,HAS ALL CHARS,HAS ANY VALUES AND HAS ALL VALUES.

    You can try HAS ANY VALUES AND HAS ALL VALUES and let me know whether it works.

    I have not worked on concat() function.

    Thanks

    Ganesh Kotti

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 13, 2007 at 07:22 AM

    Hi,

    When you have international data, checking for valid formats of address elements become complicated, as each country has different valid format (or formats in the case of UK postal code). I would suggest you use external validation of addresses using enrichment controller. External validation will not only indicate if the format is as expected, but also mark that the postal code (or city or any other element) are incorrect, and in some cases even correct the incorrect address elements.

    Regards,

    Edna

    Add comment
    10|10000 characters needed characters exceeded