Author Topic: constraining shape data (prop.xx)  (Read 123 times)

0 Members and 1 Guest are viewing this topic.

vojo

  • Hero Member
  • *****
  • Posts: 1189
constraining shape data (prop.xx)
« on: February 08, 2019, 12:21:48 AM »
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?

Yacine

  • Hero Member
  • *****
  • Posts: 2526
Re: constraining shape data (prop.xx)
« Reply #1 on: February 08, 2019, 02:15:29 AM »
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))
« Last Edit: February 08, 2019, 02:21:51 AM by Yacine »
Yacine

Croc

  • Full Member
  • ***
  • Posts: 154
Re: constraining shape data (prop.xx)
« Reply #2 on: February 08, 2019, 02:49:57 AM »
And why do not you like
prop.xx.Value = BOUND(,0,FALSE,-10000,100)
?

Yacine

  • Hero Member
  • *****
  • Posts: 2526
Re: constraining shape data (prop.xx)
« Reply #3 on: February 08, 2019, 03:49:33 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

vojo

  • Hero Member
  • *****
  • Posts: 1189
Re: constraining shape data (prop.xx)
« Reply #4 on: February 08, 2019, 09:39:14 AM »
Yacine...great, thanks...I guess I must have mistyped something...much appreciated


vojo

  • Hero Member
  • *****
  • Posts: 1189
Re: constraining shape data (prop.xx)
« Reply #5 on: February 08, 2019, 09:40:15 AM »
setf did give me "circular reference" error

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3399
  • Ideas Visio-lized into solutions
Re: constraining shape data (prop.xx)
« Reply #6 on: February 08, 2019, 12:53:29 PM »
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.
« Last Edit: February 08, 2019, 01:30:47 PM by wapperdude »
Visio 2019 Pro