on 08-26-2020 3:38 PM
Hi All,
How would l build a rule for the following.
If country is US then the postal code should be 10 digits or match NNNNN-NNNN
or is country is HK then Post Code should be Blank
Or if country is CA then post code should be X9X 9X9.
X is Alpha and 9 is a Numeric number
Hi rjwright81 ,
try something like this - it should work:
BEGIN
IF ($Country = 'US' AND match_pattern($Postcode, '99999-9999') OR
$Country = 'HK' AND (length($Postcode) = 0 OR $Postcode is NULL) OR
$Country = 'CA' AND match_pattern($Postcode, 'X9X 9X9'))
RETURN TRUE;
ELSE
RETURN FALSE;
END
Or simpler:
BEGIN RETURN
($Country = 'US' AND match_pattern($Postcode, '99999-9999')) OR
($Country = 'HK' AND (length($Postcode) = 0 OR $Postcode is NULL)) OR
($Country = 'CA' AND match_pattern($Postcode, 'X9X 9X9'));
END
Regards,
Julian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.