community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

String Comparison

Asteroid

Hi All,

 

I have got two files consisting of 552 records and 14 columns, each. The basic objective is to compare the two files and check whether there are any changes in any value of the two files. I have created a workflow successfully, which clearly tells me the fileds and the values which are not matching.

 

Now i want to go a step further, and compare the strings of the two fields, and highlight the differences in the two fields. Just to illustrate, i have created a workflow to get this from the two files.

IDNameRight Name
1ZaidMd Zaid Hashim
2NeilNeil Johnson
3JohnJohn Cena
4Mason AbbottKyle Abbott

 

Now I want to develop something that would highlight the differences in the names. 

Please note : This a dummy data and the actual values vary in size.

 

Is there something that can be done.

 

Thanks

Zaid 

Alteryx Certified Partner
Alteryx Certified Partner
In the Alteryx gallery I have posted such a comparison macro.

https://gallery.alteryx.com/#!app/CReW-Delta--Alpha-/5b41141b826fd3116445fee8

Please try it to solve this challenge.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Asteroid

Hey @MarqueeCrew , I am unable to load the macro because it seems to have been created by a newer version compared to the one that I am using. Is there any other way, i can access it.

 

Thanks

Zaid

Alteryx Certified Partner
Alteryx Certified Partner
If you EDIT the yxmc file, you can change the version downward to 10.0 or even lower.

Open with notepad.
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Asteroid

Thanks @MarqueeCrew. The macro looks good and solves the purpose. However, i was wondering if this could be done using some other tools, which i can append to my existing workflow. I have done the following steps:

 

Assigned a record id to both the files

Transposed the data

Joined the data

Filter out data where the data ("Value" field created after Transpose) coming from left is not matching with the one in the right.

 

So now I have the record ID, "Value" from left data and "Value" from right data. 

 

Now i want to find out the differences in the two values. 

 

Thanks

Zaid

Alteryx Certified Partner
Alteryx Certified Partner

@Zaid ,

 

When you open the macro, that's essentially what is going on.  Those are the tool combinations to use.  If you want to find the difference between two strings, I'm not exactly sure what you're asking.  If you join the LEFT and RIGHT outputs on ID + NAME, you should get left/right values where you can "see" the two different values.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Asteroid

Alright @MarqueeCrew , may be i did not phrase my objective correctly. I can see the difference between the values. i want to create another field,lets say "Diff" which will give only the string or character which is missing from the other value.

 

Like if one field has value "This is a bot" and the other filed has value "This is not an intelligent bot" so the will Diff will have  "not an intelligent" as its value. So whatever in the second value that is not contained in the first value and vice-versa

I hope this conveys the message.  

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@Zaid,

 

One approach (non-macro) would be to take the Left/Right records into their own TEXT to COLUMN tools and use \s as a delimiter.  Split to rows and then JOIN on RecordID + Value.  What doesn't join from your example:

 

Left = a

Right = not an intelligent

 

Here's a picture of this:

 

capture.jpg

 

You can accomplish this via a batch or iterative macro to search for each word, but I prefer to not use the macro.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Labels