Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Input to Directory Browser based on macro input

GloriousWater
8 - Asteroid

Hello. I am trying to make a macro, where i can chose a file in the macro, that will then have its "LastWrittenTime" appended. 


My problem is, that i want to make it as simple as possible for the user, so all they have to do, is choose their file and the macro should do the rest.

Currently it looks like this, and the user also have to put in the directory that contains the file. I have tried putting the file input on the dir browse tool, but then it will also add filename and file extension which the directory tool cannot read. Any ideas?

The Directory tool is used to extract the meta data "LastWrittenTime" and is then joined on FullPath. (The append tool is appending Fullpath from the fileinput, after removing |||Sheet blabla.) Unfortunately i cannot seem to use this as "input" for the file directory.

Sicar_0-1589286178313.png

 

 

 

Sicar_0-1589285766609.png

 

 

 

 

// Simon

4 REPLIES 4
fmvizcaino
17 - Castor
17 - Castor

Hi @GloriousWater ,

 

It is possible to get the folder part of your filepath to insert in your directory tool. I'm sharing an example showing how.

fmvizcaino_0-1589294901932.png

 

 

I've inserted 2 additional action tools with almost the same configuration - the formula is for you to see the results after simulating your file browse, only for you to check what is really going on.

 

The action tool has the formula: REGEX_Replace([#1], '(.*)(\\.*)', '$1') which separates the folder path from the file name .

 

Best,

Fernando Vizcaino

GloriousWater
8 - Asteroid

@fmvizcaino  Thank you very much. Ill have to look into the regex function. It seems very useful.

On a sidenote. Would it also be possible, to have the "input" path decided by a normal input tool? Say to use it as a macro, that i can place in a workflow to  append LastWriteTime to the data flow. So that no manual input would be needed. Any ideas / Directions to look? 🙂 

Sicar_1-1589352868846.png

 

So that the green input, would also update the rest of the macro.

Sicar_0-1589352833374.png

 

 

 

 

Edit: Typo. + addet picture.
//Simon. 

 

 

fmvizcaino
17 - Castor
17 - Castor

Hi @GloriousWater ,

 

Yes, it would be possible.

 

For that, you would need to select the option to show the file's fullpath of the input tool in your workflow and then use a batch macro to read it.

Batch macros: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Getting-Started-with-Batch-Macros/t...

 

A batch macro will run for each row of data entering the control parameter. Since you are giving the full path data to run your workflow, you would need to summarize the data from your file outside the macro to only give one row of data for your macro.

 

fmvizcaino_0-1589382337248.png

 

Best,

Fernando Vizcaino

 

 

 

GloriousWater
8 - Asteroid

@fmvizcaino  Thank you so much. This is been a very useful process on top of solving my issue, though each step created two new problems,but it is working now. kudos to you! 🙂

Labels