• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Field Limit with Validation

I have a field - POLICY

This is where the associate can enter a policy number. I have this on the field right now as a input vaildation

@If(In_Out !="Other" & Policy="" | In_Out !="Other" & Policy=" "  | In_Out !="Other" & Policy="  "| In_Out !="Other" & Policy="NONE"| In_Out !="Other" & Policy="NOT GIVEN "| In_Out !="Other" & Policy="NO"| In_Out !="Other" & Policy=" NONE";@Failure("Please enter a Policy Number;@Success)

Basically, there is data I do not want them to put in the field, also I would like to add this code

@Length(@ThisValue)>8;@Failure("Please enter 8 digit policy number")

That if they do put in a policy number, to not be able to put in a policy number that is longer then 8 numbers. So far, each code works great on it's own but when I try to put them together one or the other will not work correctly. Any suggestions?

Thanks
0
kali958
Asked:
kali958
  • 3
  • 2
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
Yes, simple suggestion: you are mistaklen in the priorities of the AND and OR operators. The AND has a higher precedence than the OR, which probably always leads to a failure in this case. Better to test first if In_Out="Other", everything seems okay then. ANd there seems to be something missing in the call to @Failure: a ")

Try the following:
    @If(In_Out="Other"; @Success;
        Policy="" | Policy=" "  | Policy="  "| Policy="NONE"| Policy="NOT GIVEN "| Policy="NO"| Policy=" NONE";@Failure("Please enter a Policy Number");
        @Success)

Shorter even:
    @If(In_Out="Other"; @Success;
        Policy="":" ":"  ":"NONE":"NOT GIVEN ":"NO":" NONE"; @Failure("Please enter a Policy Number");
        @Success)
0
 
kali958Author Commented:
Cool, cool - i totally see what you mean with that above, now if they do put in a value, but say it is 1234567, all policy numbers should be no less then or no more then 8 numbers. How could you put @If(@Length(@ThisValue)>8; @Failure("Please use 8 digit Policy Number."); @Success) in the mix.

It seems to really be my problem today. If i put both in, it will only vaildate one or the other.

0
 
Sjef BosmanGroupware ConsultantCommented:
Oh, sorry, I forgot :-$

    @If(In_Out="Other"; @Success;
        Policy="":" ":"  ":"NONE":"NOT GIVEN ":"NO":" NONE"; @Failure("Please enter a Policy Number");
        @Length(Policy)<>8; @Failure("Please use 8 digit Policy Number.");
        @Success)

But... this seems strange to me. Can you explain (to yourself mostly) that you test Policy for several values like " " and "NO", and then you test for 8 digits? The first test seems useless to me.

Alternative:
    @If(In_Out="Other"; @Success;
        !@Matches(Policy; "{0-9}{0-9}{0-9}{0-9}{0-9}{0-9}{0-9}{0-9}"); @Failure("Please use 8 digit Policy Number.");
        @Success)
0
 
kali958Author Commented:
I guess the problem is that as a department we have some data entry associates that are not really good at getting all the data from the call. The client will call in and instead of asking what their policy number is, they will just take the call and send it to 2nd level for support without any information. Their biggest habit is putting in Not Givin, None, No, and None or just leaving it blank, which makes it really hard for our 2nd Level support team to help them. This was requested by the Supervisors to not let them type this in the field. Does that make sense? Also, I have 2 people that are a little "to fast" on the computer and keep typing in to many numbers or not enough in the policy number field.

Thank you so much for the help, I was close but writing way to much and the shortcut you have shown me will help out so much!!! Thanks again for a A+ answer!
0
 
Sjef BosmanGroupware ConsultantCommented:
Thanks for the grade!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now