News:

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

Automatic formatting according to Shapes properties/data labels

Started by zazathedog, July 08, 2013, 12:38:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zazathedog

Hello,

I am currently trying to generate an organization chart from an Excel workbook.
First part works great, the org chart is generated and runs through different levels.

Now what I want to do is have all the contractors stand out and appear with dashed boxes; the User.ShapeType is the property defining this.

So what I am trying to do is open the document stencil, edit the master shape (currently called position) by entering the shapes's properties. Setting the User.ShapeType formula to =IF(Prop._VisDM_Contractor="Yes",3,2); _VisDM_Contractor being a property set by Excel. I then add this property to the master shape since its not set yet.
If the object has the property _VisDM_Contractor set to Yes then I want the User.shapeType to switch to 3 instead of 2 (default value).

I manage to do this for one box but not on the master shape. When I try and do it on the master shape everything goes okay, I say YES to apply to the rest of the shapes currently in place, but it does not work.

So I must be doing something wrong, I have checked other topics on this forum (http://visguy.com/vgforum/index.php?topic=239.0) but they have not worked for me.

Any help would be greatly appreciated.

Cheers,

Alex.

JohnGoldsmith

Hello Alex,

It feels like this is something you should be doing in your data to me.  Have you had a look at the sample data under:

C:\Program Files (x86)\Microsoft Office\Office15\Visio Content\1033\ORGDATA.xls (you can drop the ' (x86)' part if you're running a 32bit OS)

In this file you can see that there's a column named 'Master_Shape' and this changes the shape type - I'm describing 2013 behaviour, but I don't think that's changed.

Once your data is setting the User.ShapeType correctly, you can then reference that cell from other parts of the shape. For example, by changing the Line pattern depending on whether the value is 3 or not.

In terms of updating your instance shapes, not all updates in the master will always be reflected in the instance shapes.  It largely depends on whether the instance shapes have local values.  Also, you can't add your own formulae to User.ShapeType as this is one of the cells that Visio (or the Org Chart addon) writes to and anyway formula you put in will likely be overwritten.

Hope that helps.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

zazathedog

Hi John,

Thank you for your replay; indeed this has helped me define ahead of the OBS creating, the different types of shapes.
But I still don't manage to use formula correctly in the shapes and spread the change through all the children shapes.
I am therefore going to build a macro which will review all the shapes and edit their settings accordingly, maybe easier that way.

Cheers,

Alex.

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: 175 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1069KB.
Tokens: post-login.
Cache hits: 14: 0.00205s for 26,764 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]