Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

"Parse Error at char (n): Unknown variable..." Macro Error, No Error Workflow

joesparty
8 - Asteroid

Hello,

 

I am confused what I'm doing wrong that would cause an error when converting a workflow to a batch macro.

 

I have a workflow that produces the expected results without errors:

view_1.png

 

I've converted the workflow to a batch macro.  When I call the batch macro it can't find the field "member", however in the previous screen shot member is defined and there are no issues with the formula tool #33.  What would be causing this error message?

view_2.png

 

Cheers

25 REPLIES 25
gabrielvilella
14 - Magnetar

Does the file that you are reading when testing the macro has the member field? I know that the one you have within the macro has it.

DataNath
17 - Castor
17 - Castor

If you go to the second, 'Questions' window of your batch macro configuration window, you may just need to map it there to make sure the macro is referencing the right field from the input (i.e. if you build the macro with one field and in your live data it's named differently or something):

 

DataNath_0-1657221685015.png

 

To enable field mapping, just click on your macro input and make sure it's ticked here (Show field map):

 

DataNath_1-1657221716611.png

joesparty
8 - Asteroid

Yes the same file is used in both, therefore the 'member' field is there.

joesparty
8 - Asteroid

@DataNath I'm using a directory tool to send FullPath field to the macro to loop.  

gabrielvilella
14 - Magnetar

Are you able to share the macro and sample data?

DataNath
17 - Castor
17 - Castor

As you're looping through filepaths, is there a chance that this member field is named differently in some files?

joesparty
8 - Asteroid

The issue could be my inexperience with Alteryx and macros.  I was using the DIR tool to list all files in subfolders, there are 15 files in each subfolder.  When passing the FilePath to the macro my thought was that the input tool would only use the same file that matches.  I think it was trying to process all 15 files in each subfolder, which means the 'member' field is not in all 15 files and therefore the error.  

 

Thoughts?

DataNath
17 - Castor
17 - Castor

Yes that'll definitely be the cause of the issue @joesparty. You can read in multiple files with different schema, there's a great article on doing so here:

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CS-Macro-Dev-Reading-in-Multiple-Fi...

 

After this, you could perhaps add a filter that will remove everything where the [member] field is null, before continuing on down stream as you wish.

joesparty
8 - Asteroid

@DataNath thanks for the confirmation and link.  How can I pass/filter multiple files if the input macro accepts one input?

 

In the screen shot below I was able to pass "File 1" filter to the macro and it worked.   File 1 has 4 fields that need to be appended to File 2 in the macro.  I can't pass "File 2" filter to the macro.

view_3.png

 

Here is the view of the macro where File 1 works.  I want to process File 2, then append fields from File 1.

view_4.png

Labels
Top Solution Authors