Alteryx Designer Desktop Discussions

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

zip with R using alteryx dynamic variable for filepath

Gina2021
8 - Asteroid

Hi Community,

 

Does anyone know how to use dynamic filepaths to zip a file?  In my workbook, I have an option to use Cmd (which I gave up on first), and another option using R (still hopeful about).  Currently, this will work with hardcoded filepaths, but won't read in the data coming to the R tool on #1 line when coded as such.

 

Gina2021_0-1621280507195.png

 

Thanks tons for any hints!

Gina

 

6 REPLIES 6
EricWe
Alteryx
Alteryx

Hi @Gina2021

 

We may be able to use a Dynamic Input tool and/or Interface tools for this use case. Please contact support@alteryx.com and we will review it in further detail with you.

Gina2021
8 - Asteroid

Will do, thanks much!

apathetichell
18 - Pollux

So here's a working R version - at least on my machine...  A few notes:

 

1) R was having all sorts of issues with trying to take the correctly formatted text in without trying to reformat it as string and went through a few different tries that didn't work so to get it to work I did the following:

 

1) took out the quotes.

2) took out the concatenating

3) read in via a dataframe

4) sent the dataframe into a for loop and took the filename out as strings to a list.

 

Correctly formatted it zipped. There were a few minor housekeeping changes it wanted to get the 7-zip and flags columns in.... You'll want to hardcode or pass in a variable to provide where you want the file to write to.

 

Hope this helps!

Gina2021
8 - Asteroid

Thank you thank you thank you so much for your knowledge and magic @apathetichell !!!!!!!!!!!!! 

 

I added some doco to your R tool.

 

Gina2021_0-1621645632808.png

 

I'm working on my RegEx skills to make everything as dynamic as possible. I think I'll try to make a directory input work.  But, all of that is scope creep. You absolutely answered my question where I was completely and hopelessly stuck.

 

THANKS TOOONSS!!!

 

apathetichell
18 - Pollux

Great! And love the modifications!  I'll probably try to rework it as a batch macro to make it more universal (ie - allow different parameters for the zip function.)...

 

Alteryx R takes a bit of getting used to but it gets there in the end and can provide just awesome additions.

Gina2021
8 - Asteroid

@apathetichell Well that sounds super cool.

 

I forgot to attach where I left off...

 

Thanks again for your awesome solve!!!!

Labels