Change Line Pattern with User Info

Started by drewdb, September 29, 2008, 03:32:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

drewdb

Hi to all.

What i've got:
I've got a shape that is a line that represents a cable used in Audio/Visual.
When the user drops it on the drawing a pop up asks for the length required then another popup from the database so they can select the type of cable it will represent. This all works well.

What i'm trying to do:
I'm trying to work with the shapesheet and indexes to allow for different line patterns depending on the type of cable they have selected from the database. I gather i need to use "If" somewhere to condition the value of my Prop.Model to then change the line pattern but i'm not sure whether i can do this in shapesheet or where to start.

Any help would be great. Thanks.

Lars-Erik

#1
Line Format -> Line Pattern, in the ShapeSheet, make this change depending on the prop.model and your good to go.
I guess you just need to play around a bit to find out what exactly the value should be to get your own custom line pasterns. standard ones can be used by setting the value to 1,2,3 etc.

Sounds like you got a nice template going, good luck!

Lars

drewdb

Thanks for that. that got me in the right direction.

i added: IF(STRSAME(Prop.Model,"TCF8-24BK/WH"),SETF(GetRef(LinePattern),1),0)+IF(STRSAME(Prop.Model,"CAT6"),SETF(GetRef(LinePattern),2),0) in a user cell and all works well.

there are only around different cable types we use so it will be easy to manage.

Thanks again.

Visio Guy

Another tip or two...

Your Prop.Model is probably a fixed drop-down list (Type 1). In the cell Prop.Model.Format, you probably have semi-colon-separated list like this: "TCF8-24BK/WH;CAT6;OtherLine"

You can find out which item is currently set using the LOOKUP ShapeSheet function:

User.modelIndex = LOOKUP( Prop.Model, Prop.Model.Format )

You can then flip this and choose a pattern name, using the index returned in User.modelIndex:

User.patternName = INDEX( User.modelIndex, "Pattern1;Pattern2;Pattern3" )

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

drewdb

Thanks again,

the Prop.Model.Value is selected from a Database Record when the user drops the shape onto the doc. it doesn't have a lookup list or anything. i'm not sure, but could this be similar?

Visio Guy

Ah, you're getting it from the database. Ok. The LOOKUP and INDEX formulas might be useful in some otherway, anyway. You don't have to have a list in Prop.Model.Format, you can put lists anywhere, and lookup values from them as needed.

The reason I brought this up is that your formula is really, really long, and these two functions can make it all a bit easier to read, maintain and develop.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

drewdb

Very Very long indeed.

I'll head in the direction of using lookups.

While i'm thinking of it, there are also quite a few cable types that i'm using the same line pattern for, is there a command like "leftstring" or something that i can use if(statement) once for and gather these ones into one line?

Visio Guy

There's a pretty full set of standard string functions for the ShapeSheet, so you should be able to get substrings and do manipulations using LEFT, MID, RIGHT, SUBSTITUTE, STRSAME, LEN, REPLACE, REPT, and so on.

But again, using Index and Lookup, you might be able to say something like "if index is between 3 and 7, use pattern A"
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

drewdb

Very good point!

I'll start heading in that direction then.

Thanks again. i'll let you know how i go.