Is there a way to use a string/text "formula" as an expression in Designer?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I've got three fields
Value1 | Value2 | Operator |
1 | 2 | <= |
I need to be able to build an expression from those three fields that reads something like:
"If Value2 | Operator | Value1" then etc.
I can construct a literal string that reads "if 2<=1" but I can't figure out how to make Alteryx interpret that as an expression.
Any thoughts?
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@tmlmark Alteryx should add an eval function which would solve this! Until then, the out of the box solution is the dynamic replace. It has some really good examples if you open that in alteryx. For a third party solution, the crew macro dynamic formula could get you most of the way there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @patrick_digan. I opted for a more brute force IF statement.
If OPERATOR = "<=" and Value1 <= Value2 then 1 elseif
OPERATOR = ">" and Value1 > Value2 then 1
...etc.... else 0 endif
Would like to see your Eval idea implemented.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Really good shout @Qiu . I forgot about the dynamic replace. Someone can probably do a neater job of it, but here's my attempt,
....aaaaand in Python,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@PhilipMannering
I just happened to know it, but you are good to put it in real workflow.
Learned something and thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @patrick_digan, @PhilipMannering, @Qiu -- the dynamic replace is the way to go. 😁
