Start a new topic

Convert Postal Code to Test

I want to create a dictionary to add a unit to a constituent record based on postal code. I want to have it that if it starts with anything but T, base the unit on the first character, if it starts with T, base it on the first 3 characters. 

 

For Example:

Postal Code starts with A, unit will be Newfoundland

Postal Code starts with V, unit will be BC

Postal Code starts with T2C, unit will be Calgary

 

Any help would be appreciated


Hi Jody,

If I'm understanding you correctly your dictionary would look like this (VTMO = Value to Match on, RP = Replacement value)
VTMO ^A RP Newfoundland
VTMO ^V RP BC
VTMO ^T2C RP Calgary

RegEx turned on on all of these.

The ^ symbol tells RegEx to match the following characters exactly at the beginning of the string. So ^A means it will match on any code starting with A and it doesn't matter what follows, where as ^T2C means it has to start with T2C followed by any characters.

Thanks,

John

When I add that code and test it, the result is what I entered, not the replacement value. Am I missing something?

 


image

Hi Jody,

It looks like you need to check the box next to use regular expressions.

It works now, except that it is keeping the remaining characters and adding it to the end. Any ideas on how to remove them?

 

image

Oops. Sorry! Format the values to match on like this ^A.* ^T2C.* and so on...

Wonderful thank you so much. I had the *, just forgot the period. New to this, so still learning. Appreciate all the help. 

Login or Signup to post a comment