BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Trouble Using IF Statements in Shape Data.

Started by conmccar7, June 14, 2023, 04:16:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi All,

I'm a bit new to using some of the more advanced functions in the Shapesheet and I'm having some trouble using IF statements and nested IF statements in Shape Data. Using Visio 2019

What I'm ultimately trying to do is setup some shape data that will change as a result of a different property being changed.

I have Prop1 setup as a fixed list with options of "One" "Two" and "Three". And Prop2 setup as a string.

In Shapesheet, I have the Value for Prop2 set as:


I close the Shapesheet and change the value of Prop1 to "Two", but Prop2 does not change from "A" to "B".

I've also tried doing this as:


And Prop2 changes from "A", but only to a blank and not "B" or "C" like it should. Can anyone point me in the right direction for fixing this?

Thank you in Advance!


user.cell2 = if(same(props.prop1.value, "A"),<AAA>,FALSE)
user.cell3 = if(samestr(props.prop1.value, "B", <BBB>,FALSE)
user.cell4 = if(samestr(props.prop2.value, <golden string>),TRUE,FALSE)

props.prop1.value = "<input string>
props.prop2.value =<"string">

user.cell1 = if(user.cell2, User.cell2,if(user.cell3, User.cell2, if(user.cell4, user.cell4,"deadbeef"),"NA"),"badness")

- for easy debug use lots of cells
- start with a simple one like if (user.cellx = 1, 100,-100)
- the else clause can be another if then else, an else statement or jus a simple "comma bracket)...need the else clause noted not just hanging out there.
- can have up to 126 nested if then else in a single cell....very tough to read and figure out which one triggered.


To the immediate question, the issue is syntax.  If Prop.prop1 uses fixed list format, that would be something like "One;Two;Three".  Then, in this case, the IF construct you have works fine.  However, if the format is merely string, then, you must either enter the value without quotes, e.g.,  One.  If you actually enter "Two" which includes the quotes, then your IF Strsame test must be like this:  Strsame(Prop.prop1,"""Two""").

In Vojo's reply, it is not necessary to type the ".value".  Visio defaults to the Value cell.  If fact, after Visio accepts the entry, it will truncate and drop the .value from the formula.
Visio 2019 Pro


Thank you both so much for the help! I was finally able to get the syntax right and make this work.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 211 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1056KB.
Tokens: post-login.
Cache hits: 13: 0.00145s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]