Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Environmental Variables usage

Emil_Hasanov
7 - Meteor

Dear Community,

 

We tried to make a use of Environmental Variables (User or System) within workflows, as well as investigated many articles on the topic, which are either radically confirmed Alteryx does not support them (dated from sometime 2019) or giving a specific solution which will not help to work with Environmental Variables fully as we plan.

 

So, taking all gathered knowledge from Community articles on the topic we tried to trick logic via encapsulating of a Directory function into a Macro:

emil_hasanov_1-1610028371881.png

however, first function was always pointing the following error

emil_hasanov_2-1610028455689.png

, and then added that macro to our parent workflow, but macro was always pointing out to below mentioned error:

 

emil_hasanov_3-1610028492058.png

 

So, we trying to understand is our approach is a winning on a long term and we simply missing some bit somewhere (then please suggest what was wrong), or Alteryx in 2021 is indeed is still is not ready to accommodate useful operation with Environmental Variables.

 

Some additional details:

 

input function was set as below

emil_hasanov_4-1610028711881.png

environmental variable was set as below

emil_hasanov_5-1610028760671.png

 

formula was set as below

emil_hasanov_6-1610028811115.png

 

and output of formula function as retrieving the path which was set on system settings "C:\ALTERYX"

 

Looking forward for a useful comment.

 

Many Thanks in advance!

Emil

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @Emil_Hasanov 

 

Try using batch macro. Control parameter lets you write.

 

Since there is only one variable it will run only one run similar to standard macro.

echuong1
Alteryx Alumni (Retired)

I am a bit confused as to what you are trying to achieve - can you give an overview of your "end goal"?

 

Also, you can use environment variables with the getenvironmentvariable() function. See the below example. The variable name just needs to be in quotation marks, not brackets.

 

echuong1_0-1610032516186.png

 

Emil_Hasanov
7 - Meteor

Our goal is to define variable paths to make them calling for different target locations depending on which machine the workflow is being ran on:

 

1) workflow running on machine1 - it targets C:\ALTERYX

2) workflow running on machine2 - it targets E:\Home\ALTERYX

etc.

 

however, as you can't define Environmental Variable within Directory function of Alteryx (which are heavily used within our workflows) we tried to trick this missing functionality via marco setup.

 

Hope our target goal is clear now, and hope this trick will work 🙂 in case if we find out how it might work

Emil_Hasanov
7 - Meteor

Dear All, wanted to let you all know,

 

So, we indeed were so close to the solution, but just mixed up first function on the macro - we used Macro In instead of Control Parameter 😞 

 

So, after we replaced it in macro, it actually worked 🙂 So, we were also successful to build similar functionality to built output file using Environmental Variables 🙂

 

This capability opens up so much doors now, haha you can also benefit of it.

 

Kind Regards

Emil

Labels
Top Solution Authors