Is there a way to constrain shape data (prop.xxx)
Something like
- user enters a value (say 150 as a number)
- goal is to bound it (enforce a range....say max is 100....so 150 gets changed to 100 in prop.xxx.value cell)
- later, a user could put in a new value...say 80...rules tested....80 in prop.xxx.value cell
- value placed in the prop.xxx cell
I tried a few things, but could get it to work
- setatref, setatrefexpr, setatrefval, etc
- bound in the format prop.xxx.format cell
I don't some sort of fixed list with 20 to 100 entries is reasonable (don't even know if Visio would explode)
I know I could use 2 props....input and resulting value...label appropriately...just seems a bit amateur.
No VBA, ideally
thoughts?
is this too simple:
user.check = if(prop.xxx >100,setf(getref(prop.xxx),100),"")
?
... or:
user.check = setf(getref(prop.xxx), min(100, prop.xxx))
And why do not you like
prop.xx.Value = BOUND(,0,FALSE,-10000,100)
?
Quote from: Croc on February 08, 2019, 07:49:57 AM
And why do not you like
prop.xx.Value = BOUND(,0,FALSE,-10000,100)
?
... brilliant!
Didn't know that you can use it with input fields.
Yacine...great, thanks...I guess I must have mistyped something...much appreciated
setf did give me "circular reference" error
Croc's solutions works fine and is simplist construct.
The setf formula won't work, it does give a circular argument. Could use SETATREF with a placeholder. But, you still need to define the limit test...well, you could wrap the Bound function around the SETATREFEXPR, but so much more complex.
For sake of completeness, here's formula to put into the prop Value cell: =SETATREF(User.R1,SETATREFEVAL(BOUND(SETATREFEXPR("500"),0,FALSE,-1000,100))). The value 500 gets assigned via the normal User Shape Data entry. The value is passed to User.R1, then sent back to the Shape Data value cell. No circular error. This could be abbreviated to BOUND(SETATREFEXPR("500"),0,FALSE,-1000,100). Which puts one step removed from Croc's original suggestion.