Alteryx Designer Desktop Discussions

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

Running multiple json files and outputting multiple files

krandol5
7 - Meteor

Hello,

I completed my workflow on one json file. Now, I have a folder of about 2,000 json files I would like the to process and save each one individually as it runs through the workflow. I have spent extensive time reading on this here in the community and about batch macros but can't seem to wrap my head around it. 

I'm attaching my workflow here with one of the json files.

I'm also attaching 5 additional sample files, it won't allow me to attach .json files here, so I'm attaching them as .txt.

 

tldr;

Looking for alteryx to run the workflow on one json file, save as output json file (csv,txt,xlsx would also be fine). Grab next json file and repeat.....

 

Any assistance, pointing in the right direct is highly appreciated, thank you!

8 REPLIES 8
raychase
11 - Bolide

See attached.  Just point the directory tool to the folder that houses your unprocessed .json files.  This batch macro will process one at a time, saving it as the original filename + _processed.json, in the same directory.

krandol5
7 - Meteor

Thank you so much for the reply. I guess there is something I'm not understanding about how it works. After I point to the directory, it's not reading the incoming connection. For example, my first filters are not reading the JSON_Name field as it does when I input only one file. Here's a screenshot of my attempt, and attaching the workflow also.

foralteryxcomm.PNG

 

raychase
11 - Bolide

The directory tool doesn't belong in this workflow.  You're basically saving your workflow as a template (macro) to run 1 file through at a time (a batch). As such, you need to keep the input tool and update it using a control parameter.

 

Did you look at the workflow I attached? You literally only need to repoint my directory tool to the proper folder and then run the workflow.

krandol5
7 - Meteor

Got it thanks, I just input the directory with the json files, but it's throwing an error, "cannot find macro crew_ensureFirelds.yxmc" see screenshots below:

alteryx.PNGalteryx1.PNG

raychase
11 - Bolide

Easy fix.  You can replace it with your version of the EnsureFields macro. I noticed we seemed to have differing names for that particular CReW macro...not sure why. I had to switch yours to mine just to make the flow work on my end.

krandol5
7 - Meteor

I got it working now, thank you!

raychase
11 - Bolide

Great! No problem at all.

bersocha
7 - Meteor

Hi, I'm having the same error but I don't know how to fix it, any guidance on this?

Labels