User parameter does not equal its own value.
- 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 am vexed. I have a numeric user parameter that I need to equal 2.25%. I need to filter values that equal to 2.25%. However, for some odd reason, my parameter that I explicitly enter as 0.0225 does not equal 0.0225. I cannot get any additional information as to what is going on and it is driving me nuts.
I have attached a minimal reproducible example. It is very minimal and it does not work! This seems so basic that I must be missing something obvious but I cannot figure out what it is.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @JPM
This is super interesting. No clue why it's happening, but if you use 0.022500 in the formula (or update the constant) then it should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @JPM,
The reason why this happens is because Alteryx (and generally computers) does not store values as you see them on your screen. For example, you might see 0.001 being displayed, by your computer might store that as 0.000999999999.
For example, [User.x] might appear to be equal to 0.0225, however look what happens if you apply a round function
Your [x_diff] is not 0 anymore, but something to the raised to the power of -18.
So by using the round function, I have forced the value [x] to be exactly equal to 0.0225, but since the x_diff value is positive, that means that
[User.x] = 0.225 - 3.46944^E-18
So if you explicitly want your parameter to 0.225, think of using a round function (or do what @Luke_C suggested above, it appears to be working)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I suspected something like that but could not prove it. Do you know why it is more efficient to store 0.0225 as something like 0.022500000001 than just 0.022500000000? I thought data type just allocated spaces. There must be a reason since from my (limited) perspective it seems to introduce unnecessary inaccuracy for no good gain.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If I add two trailing zeroes to the constant in the Workflow user parameter section it does not fix the problem but it does work if I add the zeroes to the `x_test` formula, e.g.
[User.x] == 0.022500
So what is the advantage of using numeric parameters if they need to be passed to round functions just to get a working filter? I feel like I must be missing some crucial part of the process (e.g. declaring parameters more explicitly in some way) because surely this has come up before.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@JPM it's super confusing, I have an idea of alteryx providing a flag or cue to indicate when a number is displaying something other than it's true value https://community.alteryx.com/t5/Alteryx-Designer-Ideas/visual-indicator-actual-value-anytime-displa...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You put into the value to Text Input tool, after that you can use the 'correct' value.
It seems that if we put directly into expression, Designer may not interpret it as the value we intend.
