I would like to read in and append a filter string, [RunTimeFilter], to filter to a workflow. The [RunTimeFilter] would be unique for each input file as the column names would change file over file.
Example:
Col1 = 1 and (Col2 = "X" or Col2 = 'Y') for File A
ColA = 1 and (ColZ = "A" or ColB = 'Y') for File B
When manually added as a custom filter, this works, but when attempting o pass it in as a column variable, I can't figure out the syntax.
I attempted to use the dynamic filter batch macro, but I'm using the same flawed logic in a filter tool.
Any help or guidance is greatly appreciated as I didnt find a solution in other posts
Thanks in advance
To pass a dynamic [RunTimeFilter] as a variable in a filter tool in Alteryx:
Use the Formula Tool: Create a string column (e.g., FilterString) containing your filter logic.
Example:
Dynamic Filter Tool: Use the "Dynamic or Batch Filter" and point the filter expression to the FilterString column.
Use a Batch Macro: If multiple files have different filters, create a batch macro where [RunTimeFilter] gets passed as a control parameter to update the filter logic dynamically.
This avoids syntax issues by treating the filter as a string input.
use dynamic rename to change the name of the column you are filtering for in the batch macro. keep the filter field name static. so [My field to filter]=[value] in your filter stays static. the field with the name changing is variable and controlled in dynamic rename. use a second action tool to a second dynamic rename to reset to the original name after the filter.
syntax something like if [_CurrentField_]='mydummyNAME' then 'MyVariableField' else [_CurrentField_] endif
action tool changes specific field - 'mydummyNAME'
filter [MyVariableField]=[variablevalue]
dynamic rename 2:
if [_CurrentField_]='myVariableField' then 'mydummyNAME' else [_CurrentField_] endif
action tool 2 has the same config but runs in reverse.
f