How do I change my input and out file path and names based on an input list
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Labels:
- Best Practices
- Dynamic Processing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @jonghr
If you want to give the user the option to choose the environment, you can use a technique like this
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
The action tool looks like this.
Pressing the button highlighted in green gives this
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?