Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Capture User defined Constants value and write it to a file

sg1525
6 - Meteoroid

Hi All,

 

Is it possible to capture values assigned to each of the User Constants under workflow configuration and write it to  a file once the workflow is completed. Important is to capture the run time values of the constant and not the saved values in Yxmd file. 

So for example there is a constant "ABC" with value as 10 saved under yxmd file but during the execution the value is changed from 10 to 20 and workflow is executed, I want to capture value as 20 for constant "ABC'.

 

I know there is  a way to refer [User.ABC] under the formula and another field can be created which will hold the value as 20 and this can be written to an output file but the problem is I need to implement this for 70+ graphs each having individual 10-15 user defined constants. I wanted to have an automated way (Macro) for doing this task rather then creating 10-15 fields in the formula for 70+ graphs

4 REPLIES 4
gawa
15 - Aurora
15 - Aurora

@sg1525 This is curious use case for me and have no experience of doing this, but I come up with workaround like this.

 

(1) Get the name of all User Constants by referring to its workflow file and XML parsing(Blob Input=>Blob Convert).

(2) By using Dynamic Replace tool, get the current set value of User Constants

 

Here is the WF implementing this logic. At least in my computer, result shows the current set value of User Constants, not the value saved in WF. Please check it out.

My idea might be not immediate solution for you but hope it could inspire you somewhat. Good luck!

image.png

 

sg1525
6 - Meteoroid

Perfect it works for me. Thanks a lot gawa

danilang
19 - Altair
19 - Altair

Hi @sg1525 

 

Excellent solution from @gawa, leveraging the Dynamic Replace in expression\formula mode. 

 

I submit a small fix for the case where the user constant is numeric, which caused to original workflow to error with a type mismatch.

 

W.png

It simply reads the IsNumeric field from the workflow xml and inserts a ToString if it is numeric

 

Dan

 

sg1525
6 - Meteoroid

Hi Danilang,

 

Thanks for highlighting this point , it was error in my first run with the solution (due to numeric values in my user constant) and fixed it using tostring in the formula

Labels