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.

How do I change my input and out file path and names based on an input list

jonghr
6 - Meteoroid

I have a workflow that converts standard reports into a consolidated output. 

The folder and file names reference the ERP version the files were extracted from (Production).

For instance ..\\P94\P94_FBL3N.txt

 

I am being asked now to run a similar consolidation on the data in our Test version of our ERP.

Rather than creating duplicate workflows, how can I change the file path and file name to reference either Production or Test?

If I ask the user to chose Production (P) / Test (T) / Development (D), how do I update the input file references and the output file references, to create distinct new files that clearly identify P, T or D

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@jonghr ,

 

Alteryx provides the ability to use Workflow Constants (help:  https://help.alteryx.com/20214/designer/constants).  You can directly path a variable [user.path] to the directory for test or prod.  Prior to the output tool, you might have a formula tool that constructs the complete path\name.ext and inside of the output tool, take name from field.  The .\dummyfilenam.yxdb can be used as the output field (this is entirely ignored).

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
danilang
19 - Altair
19 - Altair

Hi @jonghr 

 

If you want to give the user the option to choose the environment, you can use a technique like this

danilang_0-1645881905292.png

 

Here is the config of the dropdown tool.  The value before the colon is what is displayed in the dropdown list, The value after is what is returned by the tool, P, T or D

 

danilang_1-1645881938389.png

 

 

The action tool looks like this.  

danilang_5-1645882900203.png

 

 

Pressing the button highlighted in green gives this

danilang_4-1645882367984.png

 

The expression is saying in the destination(filepath), replace "\P" with "\" + #1, the value returned by the dropdown.  If the user selects Production nothing changes.  If they select Test, all instances of  "\P" are replaced with "\T" so  "...\P94\P94_FBL3N.txt" becomes " ...\T94\T94_FBL3N.txt"   

 

In the example, I use c:\temp\Environments as the root directory for the P and T subdirectories, so you'll need to change those to suit your environment.  

 

For the output tools use the same technique, connecting the Drop Down tool to the various output tools modifying the formula in the resulting action tools as required.  You can connect the Dropdown input tool to multiple tools, so you don't have to duplicate it

 

Dan

jonghr
6 - Meteoroid

Thank you Dan,

 

This is what I am looking for.

I put it in my workflow and works like a charm on the input file.

I linked a similar action from the dropdown to the output file (a .yxdb). However in this case the workflow seems to ignore the replace function and keeps referring back to the original database name in the output step.

 

Any ideas why?

Labels