Author Topic: Change Line Pattern with User Info  (Read 6347 times)

0 Members and 1 Guest are viewing this topic.

drewdb

  • Jr. Member
  • **
  • Posts: 30
Change Line Pattern with User Info
« on: September 28, 2008, 10:32:44 PM »
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

  • Sr. Member
  • ****
  • Posts: 278
Re: Change Line Pattern with User Info
« Reply #1 on: September 28, 2008, 11:25:59 PM »
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
« Last Edit: September 29, 2008, 12:53:20 AM by Visio Guy »

drewdb

  • Jr. Member
  • **
  • Posts: 30
Re: Change Line Pattern with User Info
« Reply #2 on: September 29, 2008, 12:12:02 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Change Line Pattern with User Info
« Reply #3 on: September 29, 2008, 12:59:54 AM »
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

  • Jr. Member
  • **
  • Posts: 30
Re: Change Line Pattern with User Info
« Reply #4 on: September 29, 2008, 01:34:32 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Change Line Pattern with User Info
« Reply #5 on: September 29, 2008, 02:27:02 AM »
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

  • Jr. Member
  • **
  • Posts: 30
Re: Change Line Pattern with User Info
« Reply #6 on: September 29, 2008, 03:04:46 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Change Line Pattern with User Info
« Reply #7 on: September 29, 2008, 03:12:55 AM »
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

  • Jr. Member
  • **
  • Posts: 30
Re: Change Line Pattern with User Info
« Reply #8 on: September 29, 2008, 03:41:38 AM »
Very good point!

I'll start heading in that direction then.

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