Author Topic: IF Statements in Shapesheet Cells  (Read 7241 times)

0 Members and 1 Guest are viewing this topic.

music_al

  • Newbie
  • *
  • Posts: 7
IF Statements in Shapesheet Cells
« on: April 29, 2008, 03:31:09 PM »
I have 2 Shape Data items: Device Name and Device Type

I want to set some rules in the Shapesheet, so lets use this example...

Fruit Types ="Banana;Apple;Orange"  *I am typing this in the FORMAT box
Fruit Colors =IF(Prop.Row_8="Banana","Yellow",IF(Prop.Row_8="Apple","Green",IF(Prop.Row_8="Orange","Orange","")))  *Will this formula work and if so, where do I type it ? I have tried it in the FORMAT and VALUE cell, but neither works.

Any ideas ?


Many thanks

Allan

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: IF Statements in Shapesheet Cells
« Reply #1 on: April 29, 2008, 04:04:20 PM »
Hi music_al,

To compare strings, you'd do IF(StrSame(Prop.Fruit.Value,"Apple") Direct comparison of text in the ShapeSheet doesn't work.

Another structure that works is to use indices. That way you can change the format string without messing with your code:

Prop.Fruit.Format = "Banana;Apple;Orange"
Prop.Fruit.Value = "Apple"  (for example)

User.fruitIndex = LOOKUP(Prop.Fruit.Value, Prop.Fruit.Format)  ( = 0, 1, 2  or -1 )
User.color = IF(User.fruitIndex = 0, ...=1, ...=2)
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010