data validation using custom pattern - InfoPath Dev
in

InfoPath Dev

data validation using custom pattern

Last post 09-14-2009 02:41 PM by Mel Clemente. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-14-2009 12:11 PM

    data validation using custom pattern

    Greetings,

    I am using data validation and I want to compare against a certain pattern.  My requirements are:

    Field A is a drop down list 

    If field "A" = "X" then field "N" must start with the number 4 and be 7 characters long.  EX: field "A" = "X" ; "N" = "4123456" ::

    that part does not seem to bad..  my custom pattern = 4/d/d/d/d/d/d

    >>this is the part that is stumping me:<<

    If Field "A"="Y" then field "N" can start with either a "7" or "8" and must be eight characters long: EX. field "A"="Y" N=81234567 ->OK  or N=71234567 ->OK

    How do I validate the first character in a custom pattern to be either (7 or 8)?  ie: (7or8)/d/d/d/d/d/d/d

    Thanks for your help

     

  • 09-14-2009 01:42 PM In reply to

    Re: data validation using custom pattern

    Hello and welcome to the forum!

    For your second data validation (A=Y), you can actually separate your two conditions (7 or 8) using "OR" in the dropdown. So in this data validation, you will have a total of three conditions:

    • A = Y (and)
    • N = 7/d/d/d/d/d/d (or)
    • N = 8/d/d/d/d/d/d

    Hope that helps!

    Mel Clemente
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 09-14-2009 02:16 PM In reply to

    Re: data validation using custom pattern

    Thank you for the response.  1 more variable to throw into the mix that I did not explain before:

    if A=Z

    N="Non Applicable"  (or blank)

    If I use the "OR" statement in the validation then the field is forced to not be blank (red star in field).  I tried creating a rule that if A=Z then to set N to a default of "NA" but for some reason it never sets "N" to the letters "NA"

  • 09-14-2009 02:41 PM In reply to

    Re: data validation using custom pattern

    You'll get a red asterisk in the control if none of the data validations are met. One thing to remember, rules only fire when the field's (within the rules) value changes. Therefore, N will only become NA, if you manually select Z from your A dropdown. If you wish this rule to fire automatically when you open or preview the form, you must set it in "Open Rules" instead. You can do so by going to InfoPath's Tools menu > Form Options > Rules.

    Mel Clemente
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.