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

Alteryx Designer Desktop Discussions

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

One Parameter for using in all the Formula Tool?

madhurinani
8 - Asteroid

Hello,

Currently I have multiple formula tool used through different data sources in my workflow

But that formula tool has the same logic used applied.

 

It basically has the location to store the file.

 

The logic used in the formula: "C:\Users\abc\Desktop\folder\folder2\Output\"+[Group]+".xlsx|check"

 

I would expect "C:\Users\abc\Desktop\folder\folder2\Output\" part of the formula to be added dynamically by the user. The rest is constant.

 

I want to make the location of the file dynamic as when the user runs using the Analytics app. They should be able to enter the location of the file and then that text should be used in the formula tool.

 

 

How can I achieve that?

 

Thanks!

 

 

17 REPLIES 17
DataNath
17 - Castor
17 - Castor

Hey @madhurinani, as part of a macro I built a little while ago, I did exactly this. Whilst your use case is an application, the approach will be exactly the same - the File Browse tool updating a directory within a formula tool.

 

File Browse tool which prompts the user for their save location:

 

DataNath_0-1665653078439.png

 

The starting/dummy filepath I used to first build the macro (the other one is the same):

 

DataNath_1-1665653114901.png

 

The action tool is set to only replace the directory part of the formula expression:

 

DataNath_2-1665653161450.png

 

Like in my macro, you can use a single interface tool and have it impact on multiple tools (in this case, formula tools) by connecting a separate action tool to each. I've attached my file for you to look at and reverse engineer - hope it helps.

madhurinani
8 - Asteroid

@DataNath : Somehow when I try to reverse engineer your workflow, I'm unable to recreate the scenario that I needed.

Below are the screenshots that I did when I replicated your workflow. But once I run as Analytic App,the location still goes to defaults even if I select something from the File Browse option.

 

Any idea where I could be going wrong?

madhurinani_0-1665764651990.pngmadhurinani_1-1665764659280.png

 

 

madhurinani
8 - Asteroid

@DataNath I am attaching my workflow for reference. Forgot to upload it last time.

DataNath
17 - Castor
17 - Castor

@madhurinani from the looks of it, you're replacing the entire formula expression. As you are using the File Browse tool to change the target directory, you only want the filepath part of the formula expression to be replaced and so you'll need to reduce the replacement argument down to that. Something like the following:

 

DataNath_0-1665877659337.png

madhurinani
8 - Asteroid

@DataNath : Thank you for your feedback. It worked!

madhurinani
8 - Asteroid

hello @DataNath :

I am facing an issue when I share this workflow with someone else.

 

When the other person open the workflow, it shows an error on the Output Data side which says that they cant access the folder path that is present on the Output data tool.

 

I understand that when I create the workflow, I put the local path that is present in my system. But when someone else opens the workflow in their system, it shows an error.

 

Do you have any idea how I can fix this issue?

 

madhurinani_0-1666081671152.png

 

DataNath
17 - Castor
17 - Castor

Hey @madhurinani, this is indeed because you have set the app up with your local directory that they don't have access to. However, when the other user runs the app, this will be replaced as expected by their selection and it won't actually error, it's just when you open it as the underlying workflow. You could try making the filepath relative https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-Relative-Paths/ta-p/1160 or just explain to that it's not actually an issue.

madhurinani
8 - Asteroid

@DataNath :

Agreed on your point and i also tried to use relative paths based on the link you had shared earlier. 


To your comment: However, when the other user runs the app, this will be replaced as expected by their selection and it won't actually error.

 

This is where the issue is still coming. When the user runs the App, It allows to select the Folder using the browse condition. 

But then once the user clicks on "Finish", it points an error to the Output Tool which has the file path of my local machine.

 

Thanks.

 

DataNath
17 - Castor
17 - Castor

Apologies @madhurinani I should've noticed this the other day, but I've just had another look at your app.

 

DataNath_0-1666084910244.png

 

At point (A) of the workflow, you're asking the end user to select a folder to save the workflow to which is creating a custom filepath that then feeds into your Output Data tool. At point (B) in the workflow you're then asking them again to define a location and file name etc, even though you've already created this in the Formula tool before hand. Therefore, you only need one of these - either the Formula tool which overwrites the entire filepath, or the File Browse that acts upon the Output Data tool directly. If I run the workflow in debug mode and select a directory, you can see that this is replaced correctly in the Formula expression and so should work as the output tool is configured correctly:

 

DataNath_1-1666085183329.png

 

If you're still having issues, can you perhaps upload the actual app you're having problems with if it's not the same one that I have?

Labels