Alteryx Designer Desktop Discussions

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

Filter data from formula in a text field

dakeefe
7 - Meteor

I am trying to store a formula as a string in a text field in my dataset, and then filter the same dataset by referencing the field in which the formula is stored in the custom filter expression field. For example, the string stored in the data field [formula] will be:

 

"[field1] > 10 OR [field2] > 10"

 

and the custom filter expression will simply be:

 

[formula]

 

Is there any way to make this work?

 

 

3 REPLIES 3
patrick_digan
17 - Castor
17 - Castor

Currently, try the dynamic replace. Here's a KB article. If you post some sample data, I'd be glad to help further if you get stuck.

 

I find the dynamic replace confusing and not very straightforward. You may wish to star my idea which is to have alteryx add an eval function so that your formula would be eval([formula]) and it would then work as you're expecting. https://community.alteryx.com/t5/Alteryx-Product-Ideas/Add-function-quot-eval-quot/idi-p/42900 This sort of functionality exists elsewhere (Access, R, etc.).

dakeefe
7 - Meteor

Patrick,

 

I actually managed to do it with a really simple batch macro: Use a control parameter to update the expression value in the filter to the equation I want. The  macro returns an error in the design window because it doesn't recognize the 'formula' variable in the custom filter expression, but when you replace it with string-formula I built, it works like a charm.

 

Thanks for your reply! I'll look into using the dynamic replace another time.

patrick_digan
17 - Castor
17 - Castor

@dakeefe Good to hear! I love batch macros and use them all the time.

Labels