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

Alteryx Designer Desktop Discussions

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

Dynamic Input for the ZIP folder files

Austin004lasrado
8 - Asteroid

Hello All,

 

Currently i have a requirement, where all the downloads we are getting in ZIP file and the name of the ZIP file and the File underneath(CSV) are upended with date and time, the prefix name always stays same. when i used Dynamic tool, I have to give in formula the complete file name (Fullpath + Filename.CSV) other wise it's failing to fetch the correct file and it's giving error.  So I need help in solving this Puzzle

6 REPLIES 6
RSreeSurya
9 - Comet

Hi,

 

If you could share any sample zip files, so I can develop the workflow, as per your file names.

 

 

smoosh
8 - Asteroid

Give the attached macro a try. This is only a portion of the problem, but it's a start. 

 

I had this same issue trying to download campaign files from Bing (Don't judge!)

 

Here's the steps

 

  1. Get the directory listing for where you are storing the zip files
  2. Grab the path of the file you are looking for. 
  3. Send that path into the attached macro
  4. The macro will pull out all of the file names inside of the Zip file 
  5. Create a new value using the formula tool ([FilePath]+'|||'+[FilesList])
    1. File Path is where the Zip resides
    2. FilesList is what's inside
    3. be sure to include the '|||'
  6. Use that new value in the DynamicInput tool

It will look something like this:

flow.png

 

Finally, I didn't create the macro, and I can't remember where I found it. It's all based on Python code that you care quickly parse to see what's happening. 

 

Good luck!

 

 

--

 

 

SeanAdams
17 - Castor
17 - Castor

agree with @smoosh  - break the problem down into smaller steps, get the directory of files first, then you can extract the ones you want.

 

The other option is to unzip the files - if you google this, a few folk have used a snippet of Python within Alteryx to unzip and then this becomes much easier to work with.

 

Austin004lasrado
8 - Asteroid

Thank you @smoosh @SeanAdams , it worked for me

mystasz
8 - Asteroid

Thank you for this, this helped me a few months after the post. Question though, the macro gives me the error "Error: ZIP Metadata Reader (3): Record #11: Tool #8: The field schema for the output "Output8" changed between iterations." 

 

Do you know why this might happen? it works if one file is outputted but since its a directory with multiple files, I get this error. 

smoosh
8 - Asteroid

Without seeing the files, I can only guess. But I'm thinking that the files within the Zip archive are different. Something like:

 

File One

Name, Date, OrderID

 

FileTwo

Product, Date, OrderID

 

etc. 

 

Each file has to be the same in order for the process to work. I'd start there.

Labels