Dynamically copying another shape's text, that contains a PAGENUMBER() variable

Started by EMILE, November 07, 2012, 06:37:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

EMILE

    Hi all, I'm stuck on below issue and I am hoping someone could get me out of the woods.

The issue
I want to create dynamic off-page references which consist of two shapes. A referencing shape that ends a certain flow diagram branch and contains an off-page reference consisting of the pagenumber on which to find the reference and an index letter. On the page referenced there should be a corresponding shape, from which you then enter the destination flow at the correct process step. Both shapes should always hold the same text, as one references to the other by that text.

To this end I have created shapes that contain a pagenumber and reference letter formatted as P.XA, P.XB etc. where X is the pagenumber, which is populated automatically and dynamically with a "page info" field.  This is to ensure that whenever I reorder the pages, the pagenumbers in these shapes change also. These shapes function as the mentioned entry points into a process flow, to which other shapes, in other pages can then refer. So the naming convention is "P." for "Page", followed by the actual page number the entry point is on, then followed by a sequential index letter, distinguishing this reference from other ones in the same page. This works perfectly, in the sense that when I reorder pages, the pagenumbers of these entry points neatly follow.

I am however running into an issue creating the shapes that reference to these entry points on other pages. These should "simply" duplicate whatever is in the corresponding destination reference. I want them to do this dynamically, meaning that whenever I change the page order, changes are then imposed on the referenced pagenumbers in the texts of both the entry points of the moved page itself and those of their counterparts, the shapes on other pages referencing to these entry points.

What I did so far and how I did it

  • Created a master shape in the stencil (.vss) I am using for this file.

  • In that shape I entered the static text "P." then inserted a "page info field" referring to the page number by clicking "Insert" - "Field" and then selecting "Page Info" and "Page Number" right from the text editing mode.

This perfectly creates shapes with the desired dynamic pagenumbers in the reference text. When dragging the shape from the stencil onto the page the shape shows "P.X", with "X" being the correct pagenumber. I then manually add the sequential index (A, B, C, ... etc.) behind that. When I reorder the pages, the pagenumbers happily change with them. So if I for example reorder Page-1 to become Page-2, the reference text of a shape containing "P.1A" immediately changes to "P.2A" and vice versa. So far so good.

These shapes should now serve as a dynamic text source for the shapes on other pages referencing to them, so these contain an exact copy of whatever is in the source shape at any given time.

In order to create the target shapes that should duplicate the text of one of these entry points I have tried several things, listed below. However, no matter what I do, after an initial correct duplication of the source shape's text, the resulting text remains static. This means that whenever I reorder pages and a source shape's page number changes, its text changes, but the target shape does not follow, effectively breaking the link between the referencing shape (the text target) and its flow entry point target (the text source).

What keeps me puzzled is that that whenever I manually change the source shape's text, the target shape does follow. It just does not show this behaviour when the source's text is changed automatically following the change in page number. I am completely stumped by this.

I tried the following:

  • I created a shape on the same page as the text source shape. I then entered text editing mode and inserted a custom formula field containing the formula "=SHAPETEXT(shapename!TheText)" with or without the "0" flag. This succesfully copies the text of the source shape. However when I move the page, the source shape's text changes, but the target shape's text remains the same. When I look at the custom field I have created after the page reorder, the reference "shapename" in the formula has been replaced with "REF()".

  • I have also tried creating a shape directly on the text target shape page and doing the same thing as above, now referencing the Sheet.ID and NameU of the source shape's page: "=SHAPETEXT(Pages[NameU]!Sheet.ID!TheText)". This results in a similarly behaving copy of the source shape's text, that does not change along with the source text when the source shape's pagenumber is changed, but DOES when I manually change the source text.

  • I have tried a stepped approach, using the same SHAPETEXT() formula as above, but now entered into a user defined data label field to the target shape and inserting that as a field into the target shape's text. Same result as above.

  • I have tried creating a user defined data label in the source shape, containing the same variable page number as its text and using the SHAPETEXT() formula either to pull it directly into the target shape's text, by using a custom formula field, or into the "TheText" field of the target shape through the ShapeSheet.

So far nothing has yielded the desired result. The target shape's text remains immune to the changes forced onto the source text by changing the page order (both manually and through the reorder pages context menu opened by right-clicking the tab name). So not even referencing the NameU of the source shape's page keeps the link intact on page reorders.

I am starting to doubt whether what I want is even possible. Possibly I should use another formula than the SHAPETEXT() one altogether. Your help would be most appreciated. Future page order changes and page insertions are to be expected. These now force me to change all reference numbers manually. It's either that or accept an illogical page order in the end for the sake of preventing manual labour.

Does anyone know how to achieve the desired result?[/list]


EMILE

Wow. That simple huh? Lol.

Thanks a lot!

I learnt all about Visio from doing, Google and colleagues that didn't know the program that well either. I feel I'm only now beginning to scratch the surface of Visio's capabilities. I will definitely be spending more time here.

Thanks again,

e!

EMILE

Hmm... just found out that the standard off-page reference shape does exactly what I want, however only when moving a target page up in the page order. Then the text of both shapes changes to hold the correct page number, but when I move it down in the page order, only the target shape (the one to which is referenced; the one that is moved) changes and the referencing shape remains the same.

Re-checking my own method (which holds the benefit that I know how to create multiple references to the same target) confirms that this shows identical behaviour. So apparently the synchronization between the texts holds up only when moving the target page up in the order of things.

This could be worked around with by 1st simply moving a page 1 place below where you want it to end up and then 1 up again. However, moving a page up implies other pages moving down and after testing I can confirm that indeed any references to a page that is moved down relatively, as a result of moving another page up, is not updated correctly.

All in all, this seems pretty bizar. I'll have an in-depth look into that method you linked.


EMILE

Yet another update:

I checked the article, but with the page grid reference it is more complex than the result I need. Moreover, it refers to pagenames, not pagenumbers. This holds the disadvantage that pagenames are not automatically updated when reordering pages unless you would keep the standard "Page-1" etc. pagenames, but then the text would be too large to fit the shapes.

Apart from that, the article does not demonstrate beforehand that the method would not show the behaviour I am running into, when changing the pageorder. As imho it should not happen like this at all, it may very well be that the glitch affects this method as well. As I am totally inexperienced with these types of formulas I want to refrain from going into it too deeply, if there would be a simpler way to work around this... and there turns out to be one!

I just found out that when a page is inserted, then moved to the first page position, all synchronized shapes are correctly updated. This seems logical as all pages above the first move a place up. The good part however is that when I subsequently delete the first page again, causing all pages to move down a spot, all synchronized shapes are updated correctly again as well!

Voila, the original number of pages is restored and all synced shapes are now correct.

Remaining question: Would it be possible to have multiple references refer to the same point, using the off-page reference master and dialogue method, instead of the method I invented of manually entering the formula calling up the target's "TheText" field?