Conditional Formulas to control Layer Visibility

Started by AlexHP, November 16, 2015, 09:12:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AlexHP

OK, I'm on the verge of blowing my brains out here so I hope someone can help me with this...  :o

As usual, it seems that Visio does not work with formulas the way you might expect. I have two layers that have similar conditions on them for visibility. I am referencing values which I placed into the Document Shapesheet so that it is common to all pages. Here are the two formulas I am using:

Layer #1:
=IF(AND(TheDoc!Prop.CompType>"0",TheDoc!Prop.UnitVoltage>"1",TheDoc!Prop.UnitCtrl="A"),1,0)

Layer @2:
=IF(AND(TheDoc!Prop.CompType>"0",TheDoc!Prop.UnitVoltage>"1",TheDoc!Prop.UnitCtrl="J"),1,0)

The problem appears to be with the Prop.UnitCtrl condition. It seems that because it is text (i.e. letter instead of number) that Visio is ignoring it whereas if I change it to a number I can get the condition to work. Now, before anyone says "Then just make it a number", I can't. The letter is part of a model number code string which has both numbers and letters in it and must remain as is. So, what the heck am I doing wrong or what the heck is Visio doing wrong... or both. Please help!!! Thank you.

Alex...

AlexHP

And, of course, right after I posted this question, I found an answer. And, also as is for Visio, it has to be done a "special" way. I turns out that I have to use STRSAME in order to compare text, or string, values. Therefore, my two formulas would be:

=IF(AND(TheDoc!Prop.CompType>"0",TheDoc!Prop.UnitVoltage>"1",STRSAME(TheDoc!Prop.UnitCtrl,"A")),1,0)

and

=IF(AND(TheDoc!Prop.CompType>"0",TheDoc!Prop.UnitVoltage>"1",STRSAME(TheDoc!Prop.UnitCtrl,"J")),1,0)

respectively. Of course. Why would it not be that way...  ???

Yacine

Yacine