cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Information Steward Rule

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Julian_Riegel
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Answers (1)

Answers (1)

0 Kudos

Thanks so much