How to force MIN/MAX values in DC (user input) ?
-
**I try to limit the values that a user can input for a Dynamic Component, in Component Options dialog, but the only way I can do it now is a very nasty one. I have to use two attributes, like this:
INPUT_val = [user_input_val] cm MIN_val = 10 cm val = IF(INPUT_val < MIN_val, MIN_val, INPUT_val)
-so, I have to use val for my next operations, instead of INPUT_val.
I would like to do something like this:
(but this doesn't work, it gives me the #)INPUT_val = IF(INPUT_val < MIN_val, MIN_val, INPUT_val) MIN_val = 10 cm
I agree, it looks like a circular definition, but maybe there is another way to do that.**
-
How about
SMALLEST(v1, v2, v3, ...)
andLARGEST(v1, v2, v3, ...)
?http://sketchup.google.com/support/bin/answer.py?answer=115749
-
@jim said:
How about
SMALLEST(v1, v2, v3, ...)
andLARGEST(v1, v2, v3, ...)
?Hmm, I can't figure out how to use this on an editable attribute. A little help, please?
As I could see, I can not use the attribute itself to compare. There is no such thing asself
in DC-s? What I need is to compare the value that user inputs and IF the value is less than a minim (or more than a max.), to force that min/max. For that I had to use the attribute for INPUT, and the other one which doest the math and provide me with the result. -
self would be sort of like
current("LenX")
So something like this?
val: =smallest(current("LenX"), 10)
But I'm not sure you can do it with arbitrary attributes.
-
@jim said:
But I'm not sure you can do it with arbitrary attributes.
It seems that is not possible. The editable attribute overwrites any formula with the value from input field, once the user inputs something
C'est la vie... -
I don't know if this would help but the following Input uses a single attribute to set the value taken from Input_val; if less than Min then Min is used, if more than Max then Max is used, otherwise the Input_val is used - not ideal but it might help reduce your code a bit:
=IF(Input_val<Min_val,1,0)*Min_val+IF(Input_val>Max_val,1,0)Max_val+Input_valIF(Input_val>=Min_val,1,0)*IF(Input_val<=Max_val,1,0)
Regards, S
Advertisement