Alteryx Designer Desktop Discussions

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

Iterative Macro Help

andrewc22
7 - Meteor

I am having trouble with iterative macros.

 

I need to build an iterative macro in order to run through 2 .txt files to ensure the files have the same fields/schema, and if they do not provide an error message and if they do continue running the workflow.

 

So what I need help with is, building the iterative macro that can take in any user input and go through the fields in order to make sure both datasets have the same schema

 

Does this make sense or is there any easier way to accomplish this? Thanks!

6 REPLIES 6
markcurry
12 - Quasar

Hi @andrewc22 

 

Have you looked at the Crew macros?   There is an Expect Equal macro that will compare two files for you.  Here's a link..

 

http://www.chaosreignswithin.com/p/macros.html

andrewc22
7 - Meteor

I have, I need the macro to extract the field names so I can then run a filter to see if both files have the same fields. When I used the CReW macro, it doesn't allow me to run the rest of the workflow?

markcurry
12 - Quasar

@andrewc22  I've attached a very basic workflow that will give an error if there are any extra fields in File 1 or File 2, and if the any of the data types are different for the fields in the File 1 and 2.  Hopefully that will point you in the right direction.

 

 

pedrodrfaria
13 - Pulsar

Hi @andrewc22 

 

You do not need to have a iterative macro, you can have a batch macro (much easier to build) and make it open both txt files, and set up a conditional based on errors to see if they have the same schema or not. Should be super simple and much easier than a iterative macro.

 

Pedro.

andrewc22
7 - Meteor

Would this method keep all the data in both files and if they have the same schema move along the rest of the workflow? 

 

After I have assured the schema is the same, I have to compare the key columns.

pedrodrfaria
13 - Pulsar

@andrewc22  Inside of this package you will find a batch macro to open the txt files, after this you can set up the logic that you need to compare it.

 

Pedro.

Labels