This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
The latest release includes several enhancements designed to improve your Community experience!
Learn MoreI'm trying to make a workflow that does the following: 1) Run R Script to produce spreadsheet 2) Do stuff with spreadsheet
Since the Excel spreadsheet (Input Data) is coming from the R script, how can I put a dependency or hold to prevent Alteryx from trying to read the spreadsheet while it's being produced? It takes the R script about 2 minutes to produce the file and I need to either have a delay or have Alteryx "know" when the file's been produced.
Will the Excel file not exist before this script is ran, or does the script only update it?
if the file does not exist, you could build a Iterative macro to loop while the file is being created. To check if a file exists, the function "FileExists([filepath])" will return a value of "true" if it does. Use this to test if the file exists each loop. Place a Block Until Done tool after this iterative macro and then "Do stuff with spreadsheet" from there.
I believe you have three options.
Option a) add an additional line of script that instead of/aswell as writing to an excel file it writes to a dataframe which you can then use the write options that exist within the Alteryx R tool to output that dataframe as a stream from the R tool. This is the easiest approach by far.
Option b) write a dummy variable to a dataframe, then use the write options to pass this out of the other side of the R tool. You can then use a formula tool to give the path for the incoming file. Then use the dynamic input tool to input the file from that path. Nothing will proccess down stream until the R tool has completed processing.
I've provided an example of this option.
Option c) try and do what you have done in the R tool with the standard Alteryx toolkit.
Oh, option D, add another line of R code that reads the excel file and then use the write options within the R tool to move this into one of the output streams. This would obviously need to be your last line.
Thanks everyone. I'll be in meetings the rest of the day but will report back a solution or clarifying questions when able to!