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

Alteryx Designer Desktop Discussions

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

How can I dynamically go down a specific path of a workflow?

fiddycodes
8 - Asteroid

I have a workflow that currently processes csv files and a separate workflow for xlsx files. I want to combine the two workflows into one and dynamically process csv files and xlsx files in a specific way depending on the file I receive. 

 

We'll start with a directory tool and if the file is a csv, we'll do some processing, but if the file is an xlsx file we'll do some other processing. I tried using a filter to accomplish this.

 

My current issue is if I get a csv file for example, then the csv branch of the filter works fine, but the xlsx branch errors out. This is because the xlsx branch is expecting to process certain fields (e.g. adding a formula to make a specific field uppercase) that haven't been provided (since the xlsx branch has no data). The issue is persistent in the reverse case as well. 

 

What can I do to fix this? I've heard about the detour tool, but not sure how to make it work in my case, since I want to schedule workflows in Alteryx Gallery and it seems the detour tool works best with user input. Guidance would be appreciated!

4 REPLIES 4
geraldo
13 - Pulsar

@fiddycodes 

 


A small example to give you an idea of ​​the Detour tool

A flow that has the fullPath and type of the file.
It passes these parameters to the macro that will follow the reading flow depending on the type of file.

 

geraldo_0-1683666835496.pnggeraldo_1-1683666851902.png

 

Yoshiro_Fujimori
15 - Aurora

@fiddycodes ,

 

Could you explain the reason why you want to combine the two workflow?

If they are doing different things, I would keep them separate, in terms of "Modularity" in software design.

Is there any reason why you have to combine them?

Depending on the reason, we may be able to propose some solution.

fiddycodes
8 - Asteroid

I would like to combine them because we want to avoid creating multiple workflows that do basically the same thing, the main difference in the workflows is the macro attached to the directory tool. There are other minor differences, but this is the main thing. 

 

For CSVs:

After the directory tool comes a macro that combines all the csv files in a directory together

 

@Yoshiro_Fujimori 

 

For xlsx:

After the directory tool comes a macro that combines all the xlsx files in a directory together, even if a spreadsheet has multiple tabs (which is a common scenario).

 

We want to be able to feed in a directory and have the workflow go towards the csv or xlsx route depending on the file type.

Yoshiro_Fujimori
15 - Aurora

Hi @fiddycodes ,

 

If the data formats from two data types are mostly the same,

I guess you can safely process multiple file types in separate flow as below.

 

Any thoughts?

 

Workflow

Yoshiro_Fujimori_0-1683774087485.png

I borrowed the above Macro (in red) from the below article.

How To: Import Multiple Excel Sheets or a Specific Excel Range into a Workflow

 

Output

Yoshiro_Fujimori_0-1683774556163.png

 

Labels
Top Solution Authors