Linking Data in Shapes Between Pages

Started by argonvesher, July 01, 2009, 03:34:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

argonvesher

I'm pretty new to Visio but I've used other programs similar to it.  I have a drawing that I've split into 3 parts.  The first page of the drawing is the overall view of a plant and all its various computers with their IP address information and the name of the computer itself.  The other two pages are subsets of the first page.  Each one I've taken out some of the layers and only pasted computers that matter to what I do and the other page has the computers one of the other Techs deals with.  Basically separating out the information each of us needs within the same document to cut down on unnecessary info to do our job.  What I'd like to do is be able to change info on the overall page and have it reflect that change on either of the 2 other pages.  Dynamically changing so to speak.  Is there a way I can do this?  The shapes where the text is already are on multiple layers.  I've just started looking at this site, so not sure if this is addressed yet or not.  Again pretty new to Visio itself, but I catch on pretty fast.  Thanks!

scott

#1
Welcome to Visio -- and I'm glad to hear that you learn quickly because this particular question is going to immerse you in some interesting internal aspects of Visio! NOTE: it has also turned into a gargantuan post but it includes a ton of background that should get you where you want to go.

The basic answer is yes -- a shape on one page can "read" data from a shape on another page. There are actually several ways to accomplish this. I'll describe one that involves entering cross-referential formulae into the shapesheet. If you're not familiar with Visio shapesheets yet, check out Visio MVP John Goldsmith's blog article about this creature: http://visualsignals.typepad.co.uk/vislog/2007/10/just-for-starte.html

At the beginning of his blog post, John shows you how to turn on Visio's developer mode; if you'd like to know more about what you can do with developer mode, check out the Visio Guy's article on this topic: http://www.visguy.com/2008/08/04/top-9-reasons-for-turning-on-developer-mode/

The third place I'll refer you is the Visio SDK, which you can either download or access online here: http://msdn.microsoft.com/en-us/library/ms409183.aspx. In particular, this page -- http://msdn.microsoft.com/en-us/library/ms195648.aspx -- shows you the syntax for various ways to refer to cells in the shapesheet, including doing so across pages.

With all of that out of the way we can begin!

Open the attached Visio drawing. Observe that all three rectangles on Page-1 and Page-2 have the same displayed cost value. Go back to Page-1 and right-click on the blue rectangle. Select Data/Shape Data... and change the value in the Cost field. Observe that the value on both white rectangles also changes.

Go back to Page-1, and after turning on developer mode, right-click on the blue rectangle and select Format/Special...  Note that the name of this shape is "Process.2", indicating that it is the second shape with the name Process.

Now right click on the white rectangle on the same page and select Show ShapeSheet. Look at the value cell for the cost row and you'll see the cross-reference to the cost cell in the blue rectangle. (Why it's "Prop.Cost" and not just "Cost" is a topic for another day...)

Next look at the cost cell in the shapesheet for the white rectangle on Page-2. You'll see a bit more complex syntax that includes a reference to Page-1.

So far so good, but creating the formula for the shape on Page-2 involves a weird complication that I can't explain (I'm hoping that someone who reads this will be able to). Based on the formula that worked in the white shape on Page-1, and the syntax described in the Visio SDK, you would expect to be able to enter this into the value cell for the rectangle on Page-2:
  Pages[Page-1]!Process.2!Prop.Cost
Indeed, that's what you see in the value cell in the shapesheet. However, entering that value directly into the value cell produces an error.

To resolve the problem it's necessary to know that you can also refer to every Visio shape by its "Name ID", which consists of the word "Sheet" plus its index. Therefore, although we've seen that the blue rectangle is known as "Process.2", it is also known to Visio as "Sheet.2".

It turns out that if you enter
  Pages[Page-1]!Sheet.2!Prop.Cost
into the value cell, it is not only accepted -- but it is immediately changed to "Pages[Page-1]!Process.2!Prop.Cost" and works fine!!

This has become a terribly long way of coming back to my original short answer -- yes, you can use cross-page references for shape data. However, as you can see, you need to know the particular syntax, and you may need to revert to using the Name ID of each shape.

If you have a lot of shapes that you want to outfit with cross-page references, you'll probably want to use VBA to automate the Task. Another topic for another day...

Before I finish this incredibly long answer, let me refer you to the work of one more Visio expert, Paul Herber. Paul's Visio Super Utilities (Visio Super Utilities) include shape reports that will show you all of the many ways that shapes are identified internally (yes, there are more than the couple I referred to above).