I have 2 tables:
Table1:
Record_ID | Country_Key | Postal_Code |
1 | USA | 10023 |
2 | USA | 2007294 |
3 | AR | 8001 |
4 | IN | 11001702 |
5 | BR | 90096 |
Table2:
Country_Key | Postal_length |
USA | 5 |
AR | 4 |
IN | 7 |
BR | 5 |
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!
Solved! Go to Solution.
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.
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.
Thanks, David! much appreciated!
Thank you @echuong1 !