Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Workflow constants in SQL editor of input data

Ravy12
7 - Meteor

Hi Experts, Can you please let me know if workflow constants can be used in the sql editor screen while importing SQL database.

 

I mean to put a workflow constant in below screen.

 

For eg, in place of '7' below, in dateadd, can i pass a workflow constants which user can specify while running the workflow. 

 

Ravy12_0-1611854481995.png

 

4 REPLIES 4
JagdeeshN
12 - Quasar
12 - Quasar

Hi @Ravy12 ,

 

You can use the User Constants  as parameters within a query. These are set in the Workflow Configuration tab. 

 

For example, you could create one that is "Begin_Date" and one that is "End_Date" and populate them.  In this case your Where clause would look something like this:-

 

WHERE DateField BETWEEN '%User.Begin_Date%' AND '%User.End_Date%'.

 

Hope this helps.

 

Best,

Jagdeesh 

K_Taylor
5 - Atom

Hi - thanks for the solution above. The '%user.fielddate% syntax was working fine for me until my Alteryx version was updated to 2022.1.1.40869 and now it simply adds a column with the text %user.fielddate% as a V_string rather than referencing the required constant in date format.

 

Any ideas on how to correct this?  Thanks

K_Taylor
5 - Atom

And solved just as I posted the question!  I needed to alter the Workflow Configuration Type to be 'Analytic App' rather than 'Standard Workflow' and it now works as required.

 

Leaving up my original query in case it helps other users.

jmcconnell
6 - Meteoroid

I have been struggling with this now for the last day.  My situation is slightly different as I'm trying to do this within a Batch Macro but I don't know why that would mean I can't reference a Workflow User Constant in the SQL Editor of an Input Control.  This was working fine with values hardcoded into my SQL query but as soon as I try to use the User constant I my query is no longer valid.

 

jmcconnell_0-1683727311448.png

 

 

Labels