Separator into Shape Data

Started by bakervisgal, November 26, 2012, 09:43:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bakervisgal

Hello! So I am trying to code a container into a Shape data attribute. I have already done this for the swimlane with the following code in the ShapeSheet:

=IFERROR(CONTAINERSHEETREF(1,"Swimlane")!User.VISHEADINGTEXT,"")

So basically this shape data attribute is populated by whichever swimlane that shape sits in. I want to manipulate this so that instead of calling the name of the swimlane container, it calls the name of the separator container (a vertical separator rather than the horizontal swimlane). Is there a way to do this? I'm new to ShapeSheet code so I appreciate all of the help!

JohnGoldsmith

Unfortunately it's not as simple as the swimlane header.  The Swimlane shape has a User cell (which you're referencing in your formula), but the separator shape doesn't.  The problem is that the heading text for the separator is in a sub-shape and isn't surfaced in any ShapeSheet cells.

You can get to the separator from a child shape using the 'Phase' category, but it doesn't contain any text:

IFERROR(SHAPETEXT(CONTAINERSHEETREF(1,"Phase")!TheText),"")

If you feel think you can rely on the sub-shape ID always being two more than the parent then you could try pushing the formula into another cell:

=SETF(GetRef(Prop.Owner),"=SHAPETEXT(Sheet."&(CONTAINERSHEETREF(1,"Phase")!ID()+2)&"!TheText)")

This would set Prop.Owner to

=SHAPETEXT(Sheet.18!TheText)

As you can see there are a number of problems here.  For example, if you move the process shape then you want to update the formula so that it's pointing at the correct phase.  You'd also want to wrap bit more error handling for other situations such as if the separator was deleted.

I'm really just writing this down as it's an interesting ShapeSheet problem, but the more robust answer is to add a User cell to the Separator master shape.  That way you can rely on the correct information being in a shape you can actually reach.  So, if you add the following user cell to the separator master:

User.MyPhaseText = SHAPETEXT(Sheet.18!TheText)

...where '18' is the ID of the sub-shape, you can then use the following formula in the process shapes:

=IFERROR(CONTAINERSHEETREF(1,"Phase")!User.MyPhaseText ,"")

Looking around I see that David Parker's already tackled this one over here:

http://blog.bvisual.net/2009/09/07/visio-2010-containment-and-cross-functional-flowcharts/

Anyway, I hope that helps.

Best regards

John


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