Hello.
In my survey I have two related fields: Product (select_one) and Rate (decimal). The range of acceptable values in the Rate field depend on what Product is selected. For example, if Product 1 is selected, the constraint is >=0 and <=2. If Product 2 is selected, the constraint is >=0 and <=50, and if Product 3 is selected, the constraint is >=0 and <=100.
As a test, I tried something like the simplified example below, hoping for a small, early win but it fails:
(.>0) and (if(selected(${productId},'prod1')), .<=2,.<=500)
Any thoughts on the equation i should be using?
Solved! Go to Solution.
You have an extra paren after prod1. try this
.>0 and if(selected(${productId},'prod1'), .<=2,.<=500)
If that does not go I tend to write it all out
if(selected(${productId},'prod1'), .>0 and .<=2, .>0 and .<=500)
If that still does not removed the dot and use the full field name notation. I have seen it happen where the short hand . gets messed up when its complicated.
I have done this successfully.
Hello @Trippetoe,
There's a bit of a mismatch in the parenthesis. The second parenthesis shouldn't be after the selected() function but instead after the if() statement.
Try:
(.>0) and (if(selected(${productId},'prod1'), .<=2,.<=500))
You have an extra paren after prod1. try this
.>0 and if(selected(${productId},'prod1'), .<=2,.<=500)
If that does not go I tend to write it all out
if(selected(${productId},'prod1'), .>0 and .<=2, .>0 and .<=500)
If that still does not removed the dot and use the full field name notation. I have seen it happen where the short hand . gets messed up when its complicated.
I have done this successfully.
Hello @Trippetoe,
There's a bit of a mismatch in the parenthesis. The second parenthesis shouldn't be after the selected() function but instead after the if() statement.
Try:
(.>0) and (if(selected(${productId},'prod1'), .<=2,.<=500))
Ugh! I hate it when i do that. Both responders are right - i had mismatched parentheses. Thanks to both for being the second and third set of eyes on my code.