Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Constant

JorgeTB
5 - Atom

 

Hi all,

I'm working on a workflow where I’d like to define several user constants to make it easier to maintain — especially when we need to update things like legal entities or captions to include or exclude.

The goal is to centralize these filters using constants instead of hardcoding values in multiple tools.


Here’s an example of the filter logic I’m currently using in several steps:

 

[Caption] IN
("2610", "2620", "3410", "3430", "3450", "4310", "4320", "4330", "4734", "4760", "4770", "4780", "4310", "6910", "6911", "6920",
"6921", "6930", "6931", "6940", "320L")
AND
[Entity] NOT IN ("8700", "8759", "8760", "8761", "8790", "8791", "8797", "8803", "8809")

I’m trying to build constants for these lists (captions and entities), but so far I’ve only managed to get it working with one entity and one caption at a time.

Has anyone found a clean way to store and reuse these kinds of multiple-value filters using constants?

Any help or example would be greatly appreciated!

Thanks in advance

8 REPLIES 8
aatalai
15 - Aurora

@JorgeTB I'm not 100% sure what the ask is, but I'm guessing it is that users put in a list captions and entity and you want to create a filter statement based on that? If so this is how I did it.

 

I created the filter statement concentrating using the summaries tool the two list sources, then unionid them and concated the two statements and fed it to a batch macro that the filter statement dynamically updates/

 

Please let me know how you get on 

 

Screenshot 2025-07-10 140704.png

JorgeTB
5 - Atom

@aatalai thanks a lot for the quick reply, I will try to use your example. looking at your flow in the snapshot can you explain why I don´t see any symbol in the last icon??

aatalai
15 - Aurora

@JorgeTB it's a macro, I've also attached the workflow for you so you could use that without needing to rebuild it

JorgeTB
5 - Atom

Call me stupid but how can I point this in a formula what do I need to write

Currently I have this 

[Caption] IN
("2610", "2620", "3410", "3430", "3450", "4310", "4320", "4330", "4734", "4760", "4770", "4780", "4310", "6910", "6911", "6920",
"6921", "6930", "6931", "6940", "320L")
AND
[Entity] NOT IN ("8700", "8759", "8760", "8761", "8790", "8791", "8797", "8803", "8809")

What do I need to write to call the Macro

 

thanks again for your help chatgpt wasn´t able to help me lol

dataguyW
11 - Bolide

I'm not sure if you are trying to reuse the constant just within this one workflow, or across multiple workflows and/or user across your org.   If it is just in this workflow, you could try using the WorkFlow - Configuration --> Workflow and use the "+" to add a new constant variable.   This would be your list of values  "1", "2",  "3"    These are then available in your formula and filter tools under the "X" which shows fields in the Constants section.    This could work for one workflow.

aatalai
15 - Aurora

@JorgeTB thanks for your qs, in the workflow I attached in the original post it does that via a control parameter, please let me know if you need any further information, you can also find more info about macros here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Macros 

Carlithian
11 - Bolide
11 - Bolide

Ahoy, 


I can see why you would like to build this with workflow constants, but from a useability view I can see it being very annoying to review and update over time due to the number of codes making the constant so long. 

 

What @aatalai has put together for you should work here, and it breaks down into two key parts 

1 - creating the formula for the filter 

2 - putting that formula into the filer

 

1. In his example the data is sitting in a text input, you can keep it this way and update the text input as an when needed, or it could connect to another data source (file, database etc) to allow someone not working on the workflow to update the list/s whenever they need to. 
This data is then formatted ready for the filter tool mainly using the concatenation ability of the summarize tool. 

 

2. Now putting this statement into a Filter Tool is a little tricky, as we can't just treat the concatenated data like it will work in the IN statement. The Batch Macro that @aatalai  has made takes in the data that you are wanting to filter, and the formatted statement.  The Action Tool allows you to overwrite the settings of a tool, so in this case updating the Custom Statement and inserting your one, then returning both outputs from the filter back to the main workflow.

 

Hope that makes sense :)


Happy Alteryxing
JorgeTB
5 - Atom

Wow you guys rock, I have like 40/60 hours of experience in Alteryx and it´s really addictive honestly

once I have the workflow ready I will share it and ask for some advice were I can improve my coding style

 

Labels
Top Solution Authors