Free Trial

Alteryx Designer Desktop Discussions

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

Batch macro configuration (process chunk of lines)

Bargeton
7 - Meteor

Hi,

 

I have a table which describe some check rules to be applied on some files, like this:

 

rule idcolumcomparatorvaluefilename
r1A<25file1_dummy.xlsx|sheet1
r2X=42file1_dummy.xlsx|sheet1
r3G>13file2.xlsx|sheet2

 

In this table, I have 3 rules:

  • r1 and r2 must be applied on file1_dummy.xlsx
  • r3 to be applied on file2.xlsx.

 

 

I try to create a "batch" macro wich take in control parameter a table with the unique list of files:

 

filename
file1_dummy.xlsx|sheet1
file2.xlsx|sheet2

 

and in input the first table.

 

 

Into the macro (yxmc), I've done some dummy treatment like:

  •  counting the number of row in the file,
  •  and counting le filename length;

then output all this.

 

Note that I have 3 lines in file1 and 4 lines in file2.

 

The input module, is the copy/paste of data of the first line of the first table (and I've put the same name in the header row).

It's confogured to be a "batch macro".

 

 

icon.png

 

Finally I try to use my macro in my main workflow (yxmd) in many ways / configurations :

 

 - Without any grouping, it output 2 times the first line:

countrule idcolumcomparatorvaluefilenameLength
3r1A<25file1_dummy.xlsx|sheet123
3r1A<25file1_dummy.xlsx|sheet123

 

 - With Control GroupBy Field : filename,  I have the same result:

countrule idcolumcomparatorvaluefilenameLength
3r1A<25file1_dummy.xlsx|sheet123
3r1A<25file1_dummy.xlsx|sheet123

 

- With Control GroupBy Field : filename and, Input GroupBy Field: filename; the output is a little bit more interesting, but not yet what I want:

countrule idcolumcomparatorvaluefilenameLength
3r1A<25file1_dummy.xlsx|sheet123
4r3G>13file2.xlsx|sheet217

 

 

If I use any other filed in Input GroupBy Field; it make an error at the execution as the input file Worksheet1.xlsx is not existing.

 

 

What I excepted to have:

 - my macro be called 2 times with 2 chunks (grouped by filename)

 - 1 chunck for file1, with 2 first line in input

 - 1 chunck for file2, with 1 last line in input

And so that, it will load each file only 1 time (and so here in my example, not load the file1 two times).

 

How can I achieve this?

 

Regards,

 

Alex

4 REPLIES 4
mceleavey
17 - Castor
17 - Castor

Hi @Bargeton ,

 

You don't appear to have created a batch macro but a standard macro.

Can you provide the batch macro so we can have a look? Also, if you could package some dummy data to show what you are trying to do.

 

Thanks,

M



Bulien

Bargeton
7 - Meteor

It's configured as a batch macro as you can see in the screenshot.

 

batch_macro.png

 

I will not able to share any code unfortunately :/

 

I've created a simple workflow to use this macro, with 2 text inputs.

As you can see, I configure to group by Filename.

I've put 3 comments with a background image to display the input table, and the computed output table.

The line 2 with control id R2 is missing from the output..

test_workflow.png

 

Regards,

 

Alex

Bargeton
7 - Meteor

Ok so in fact... in the macro, the module "dynamic input" from the developer package, load only one file.

So the output has only 1 table, and the count.. count only the line for one table.

 

It's not really a problem as it's exactly what I want: load only 1 time the file (and as it's a batch macro on filename, it will call the macro with unique filename in input).

 

I not really understand why it's load only 1 time, or have only 1 table in output... even if in the macro, to test it locally by executing it directly, I put 2 distinct files into the list of the input, it load only the first line.

 

Regards,

 

Alex

grazitti_sapna
17 - Castor

@Bargeton, try this macro. Just change the input directory to your folder.

grazitti_sapna_1-1655118905213.png

 

grazitti_sapna_0-1655118890524.png

I hope it helps!

 

Thanks!

Sapna Gupta
Labels
Top Solution Authors