Alteryx Designer Desktop Discussions

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

Configuring Dynamic Input tool in a macro

wiese-til
5 - Atom

Is there a way to configure the data template value of the dynamic input tool through an interface tool such that it is possible to switch between different file types?

What I'm trying to write a macro that reads only those files from a directory that have been created or changed since the workflow last ran. The use case would be if another ETL process creates files for us and we do not want to read every file in the directory every time a new file arrives.

I think I've established the basic workflow, but the issue is with turning it into a macro. More specifically, the user needs to be able to set the template file for a dynamic input tool as part of the macro configuration. This works fine if the file is of the same type as the one used to create the macro, but not when it's a different file type (e.g. csv vs xlsx). If I try to switch between the two, I either receive an error that I need to specify a table name (when creating the macro with an xlsx and selecting a csv when using it) or that the syntax for the file name is wrong (when going from csv to xlsx, because the file name will include a pipe flowed by the sheet name).

To recreate the issue it suffices to select an xlsx file as the data template in the configuration of this macro (the community wouldn't let me attache either yxdb nor zip files). For the macro to work the last run.yxdb needs to be in the same folder as the macro.

I suppose I could create versions of the macro for different file types, but if possible I'd like to avoid that. There a better way to configure the dynamic input tool or even achieve the purpose of the macro in a more efficient manner?

3 REPLIES 3
chris_love
12 - Quasar

Hi Christophe

 

I'd say the best way to achieve this would be to use a detour tool to push the macro down different routes. The detour would be configured by an action tool to swtch direction dependent on the format specified and down each route the dynamic input would be configured differently. You can next detours to get to the desired number of options.

 

Other options include editing the fileformat option as you have done but the difficulty is that you then need to control the format specific options, which can differ. You can edit the XML via an action tool to control this but it's getting a little more complex and unnecessary given the simpler detour option.

 

I haven't looked at the macro you posted (the best way to attach it to the community is to "export" as a package via the Options menu) but I can do if you struggle with the detour method and need more details..

 

Regards

Chris 

 

 

wiese-til
5 - Atom
Thanks Chris,

The detour is a good idea, I'll give that a try this evening.

Kind regards,

Christoph
wiese-til
5 - Atom

In the end I figured it would be better to ask the user to use a Dynanmic Input tool straight after the macro. This allows the user to use settings such as the delimiter of a csv file, which would be difficult to do as part of a macro configuration, as you pointed out Chris. I've attached the macro if anybody is interested/has use for it.

Labels