Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Use output file of one workflow from another workflow in Gallery without using chained app

Jithendra
8 - Asteroid

Hi,

We have 2 dependent Alteryx App's, published in Gallery (i.e. first app output is the input to second app). We have published these app's as 2 different apps in the Gallery instead of creating the chained app. Because, we need to trigger these app's from our web application as well by using Gallery API's. As Gallery API's will not support Chained app's so we have published these 2 app's as separate apps.

To work these 2 app's as chained apps in the Gallery, we are triggering the second workflow from first workflow using the Gallery API. I.e. after first workflow generated the output file, then we will call the second workflow from the first workflow itself by using gallery API. 

Here my issue is, how can I pass the output file path of first workflow to the second workflow. I am trying to use, Engine.TempfilePath, but it is not working. 

Is there a way that, one workflow of the Gallery can access the out put file of another workflow of the Gallery, where these 2 workflows are not chained workflows? One option can be UNC path, but when multiple users are running the same workflow then the output file name will be same for all users and will be overwritten by each other, then it will cause an issue. So, can we access the output file saved to temp folder of first workflow with process id from the second workflow?

 

Your thoughts will be appropriated. 

 

Thank you

 

10 REPLIES 10
DavidP
17 - Castor
17 - Castor

I don't think TempfilePath will work as it will differ for the 2 apps. I think you will have to create a static folder on your server (or on a network drive) where the output files from the 1st app is written to, for the 2nd app to pick it up. 

 

The problem you mentioned is that the files will be overwritten if different users run the apps. Perhaps you can add another Text Box field in the app where the user adds their name or some other identifier that then gets added to the filename. You can also add a datetimestamp to the filename and use logic in the 2nd app that filters on files generated in the last couple of minutes, or something like that.

Jithendra
8 - Asteroid

Hi David,

Thank you so much for your suggestions. 

As you mentioned, the end user is client, and we may not be able to ask them to provide some unique names 🙂 . I though about time stamp and even I thought about Uuid for file name. But my concern is that, all these files need to be placed in a single folder. These workflows will be used by multiple users of multiple clients. So keeping all data in the same folder may not be safe. If it is temp folder, it will be created with Uuid for each user process and these are taken care by Alteryx engine itself. This is the reason I am looking for the option that, is there a way that one workflow output file (which will be copied to the respective user process temp folder) can be accessed by another workflow and how can we read the temp folder file path of each workflow where the file got copied. 

 

Thank you

DavidP
17 - Castor
17 - Castor

The problem you have is still how to pass the file name and location to the 2nd app or workflow. There isn't a handy method in Alteryx to do that, which is why I suggested that you control this process by specifying the folder and filename in your workflow. I think creating some sort of unique identifier for every customer is key, for the very security reason you mentioned. 

Jithendra
8 - Asteroid

Hi David,

Thank you for your reply. 

Is there a way to create one variable at the workflow level to store the Uuid and use it as suffix to all my output files. I.e. one of my workflow will provide 5 output files. I would like to suffix or prefix the single Uuid for all 5 output files. 

For example if my workflow out put file names are File1.xlsx,File2.xlsx,File3.xlsx,File4.xlsx and File5.xlsx. At the begin of my workflow I would like declare a variable like UniqueFileid and populate it with Uuid. if the Uuid is 'abc6a56b-dfbc-445b-a691-6d75b356408d' then my output files should be saved as File1_abc6a56b-dfbc-445b-a691-6d75b356408d.xlsx, File2_abc6a56b-dfbc-445b-a691-6d75b356408d.xlsx, File3_abc6a56b-dfbc-445b-a691-6d75b356408d.xlsx etc.,

If I ran the workflow next time, the Uuid shoud be changed. I.e. for each run the output file should generate with Unique Uuid.

DavidP
17 - Castor
17 - Castor

Sure, you can do it easily like below. The problem is still, if you have subsequent workflows, how will they know which files to use?

 

In my mind, if the workflows are run straight after each other, you can use the creation time and a datetimediff formula to filter only files created in the last few minutes. Something like:

 

datetimediff(datetimenow(),[creation time],'minutes')<2

 

DavidP_0-1589267258804.png

 

Jithendra
8 - Asteroid

Hi David,

Thank you so much for such a nice example. I have also tried exactly the same which you have written :). It is working. But I need to test this same one with my complex workflow. If I need any addition help I will post the same.

To answer your question, how to the subsequent workflow know which file they need to take, I have created one Javascript custom tool, which will trigger the workflow of Gallery using API endpoint. 

This is the sequence of my workflow execution.

1. First workflow will generate the output with Unique key appended and saved in a network shared path.

2. After the first workflow execution got completed, my custom tool will trigger the second workflow using Gallery API. To this tool I need to pass the workflow name and based on this workflow name the tool will trigger the respective workflow and generates the output. 

3. This custom tool will take the Unique id as input and passed to my second workflow (i.e. like textbox input of second workflow).

4. My second workflow will use this unique id to create the dynamic input file names, i.e. it will match with the first workflow output. Then it can read the files from this network share path and process the data.

 

Thank you,

 

Jithendra
8 - Asteroid

Hi David,

This solution working. Thank you for all your inputs. 

Jithendra
8 - Asteroid

Hi David,

I have created a workflow and published in my Gallery. I have shared this workflow with 2 clients. For example Client 1 and Client 2. This workflow uses database connection to read the data from respective client database. So at the time of running the workflow I would like to read the collection name in the workflow itself. So that based on the collection name I will build the dynamic db connection for respective client name. 

So my issue is that, how can we use a single workflow to connect to different client databases based on the collection from which the user is executing the workflow. Here I don't want to duplicate the workflows for each client, because we have around 100+ clients. 

 

Thank you,

Jithendra. 

DavidP
17 - Castor
17 - Castor

You might be able to use a text box interface tool for customers to input some sort of identifier and a reference lookup table in your workflow with a join tool to identify the customer database table and then use this result to update the table name in your input data tool with an action tool.

 

It will take a bit of playing around, but that's the general idea.