Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to compare postal code lengths

Jairacha
7 - Meteor

I have 2 tables:

 

Table1:

Record_IDCountry_KeyPostal_Code
1USA10023
2USA2007294
3AR8001
4IN11001702
5BR90096

 

Table2:

Country_KeyPostal_length
USA5
AR4
IN7
BR5

 

What I want to do here is to compare the lengths of the postal codes in Table1 - Postal_Code to the Postal_length in Table 2. The Postal_Code should match the number of characters that the Postal_length needs to be. I'm a beginner so not sure how or which tool i should use for this? Thank you again for the help!

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

Hi @Jairacha 

 

Welcome to the Alteryx Community.

 

Here is an example of how you could do this. 

 

I start by changing the postal code from a number to a text value, which makes it easy to determine its length. Now you can match the lengths for each country from Table 2 to Table 1 and see which ones are different.

 

DavidP_0-1610464767490.png

 

echuong1
Alteryx Alumni (Retired)

There are always multiple ways to achieve something in Alteryx! I personally look to streamline things and be as efficient as possible and combine functionalities to get to as few tools as possible.

 

Another method is to join on the country key to get the proper lengths and postal codes on the same line. From there, you can use a filter tool to check to see if they are the same length. If so, it will be returned out of the T output. If not, it will be returned out of the F output.

 

The same concept and formula applies if you want to create flags in a Formula.

 

echuong1_1-1610466699111.png

 

 

Jairacha
7 - Meteor

Thanks, David! much appreciated!

Jairacha
7 - Meteor

Thank you @echuong1 !

Labels