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
DataNath
17 - Castor
17 - Castor

@joesparty I'd try putting these filters inside the macro so there's a check that, if the member field is there and there's the same amount of fields as expected then it Outputs from the macro, if not it just does nothing - then when all iterations are completed the Batch macro should just append all of the successful results together automatically by name if you've selected that option.

joesparty
8 - Asteroid

@DataNath agree with moving these filters inside the macro, but is that possible with; control parameter, action, input?  I wasn't able to connect the filter tool.

view_5.png

DataNath
17 - Castor
17 - Castor

No you won't be able to place a filter there. I was thinking you could place it just before the macro output so that if the file is there and passes through alright it'll output and be appended to the others, if not it'd be discarded (not output to anything).

joesparty
8 - Asteroid

@DataNath apologies, I'm lost!  

  • I had a filter for a specific file before the macro.
  • I think your suggestion was to place it inside the macro, correct?
  • The filter is used to select the correct file for the input tool, how can I place the filter before the macro output? My thought is the macro would fail because it would be trying to pass 15 files (in each subfolder) vs. the one I'm trying to filter on.
DataNath
17 - Castor
17 - Castor

What exactly is your macro doing @joesparty? With you initially saying you wanted to loop through filepaths, I thought you meant you wanted to do this and just have a consolidated dataset of all suitable files. This is why I suggested using a Filter just before the output to only output suitable files from the macro. However, if you know what files you want to process then the approach will be different.

joesparty
8 - Asteroid

@DataNath I am trying to get the macro to:

  • get a list of folders, currently 40 folders with 15 files
  • loop through each folder and process 8 of the 15 files
  • create a results file for each kpi

Knowing the exact files to process how would apprach it?

 

DataNath
17 - Castor
17 - Castor

Do the target files have anything special like named differently or have a unique way of setting them apart? Failing that, I can think of a method using the Field Info tool to check if each file contains the [member] field and, if not, exclude them with a filter before feeding them to your control parameter. This would perhaps need to be a nested batch macro though.

joesparty
8 - Asteroid

There are specific file names as a unique way of setting them apart.

DataNath
17 - Castor
17 - Castor

Ok @joesparty, in that case, after the initial Directory tool, you can just filter based on whatever that unique identifier is - that way everything that comes out of the true anchor should be these suitable files and feed into your batch macro fine.

joesparty
8 - Asteroid

@DataNath agree with the approach.  The issue is I can only pass 1 filter to the macro.  I have to pass 8 files, won't the macro still fail because the input tool is not looking for a specific file name?  So Input File 1 would work when passing File 1, but fail on File 2.

Labels
Top Solution Authors