Alteryx Server Discussions

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

Gallery Temp folder How to write files too

bsharbo
11 - Bolide

Hello everyone! Thank you in advance for your help with this (hopefully) simple question :-)  I have built an application that writes output to a Template Excel file.  I write my output to three seperate Named Ranges on various tabs, and the Excel file is highly formatted.  

 

 

This Excel file is saved on a Network path location, and I could hard-code this path as a UNC path that way when I deploy my app to my company Gallery the application will still write to this file, however this does raise one problem: Concurrency.

 

My issue is:  I will have many users (20-30) who will need to run this app, and the odds are two of them will run the app at the same time.  Because of this I cannot have the app point to a hard-coded file on a network path, otherwise the users will mess up each-others work...

 

My Solution (I don't like):  I have been writing code that will check the Datetime, and create a new folder on the network path with the time name, such as "2016_09_12_11_01_01".  I then copy the template Excel file into this folder, and then output to THAT file and display the results to the user through the app interface.

 

What I need help with: I know that when an app runs on the gallery it creates a Temporary Folder that it writes data too... I'd like to copy the Excel Template file TO the temporary folder that is automaically created during run time, and then write to THIS folder location.... However I don't know how to do this! :-)

 

I tried writing to .\%temp%   and too %temp%  and too \%Temp%, etc.. but nothing seemed to work so I am clearly doing something incorrectly.

 

Does anyone have any experience with this problem?  Thank you! :-)

 

 

1 REPLY 1
patrick_digan
17 - Castor
17 - Castor

@bsharbo You should be able to package your template excel file as an Asset and then it should write to the temp directory. Here is a good post, especially the post by @jarrod. For what it's worth, the %Temp% should be correctly writing to the temp files, but %temp% is no longer displayed as an output to the user in the gallery (starting with 10.1 I think). You can however use %Engine.WorkflowDirectory% to write to the temp space and have it displayed to the end user in the gallery (until they take it away Smiley Happy).

 

Let me know if that doesn't solve it!