Reference to Current Page

Started by DavidJT, December 04, 2014, 10:28:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DavidJT

I have a complex table object that I have created and for each row in the table a round "tag" is created.  The tag has a "duplicate" action that creates a clone of itself.  The purpose is to create a table-based call out list where the cloned tag can be located anywhere on the page.  Updating the properties of the tag in the table automatically updates the cloned tag's properties (i.e. fill, text, font, etc...) and will work with multiple clones.  When the table row is deleted, all orphaned tags are found and deleted as well.

The issue that I am trying to find a resolution to is related to the cell references in the clone back to the original tag.  In their current form, these reference look something like:

FillForeGnd = GUARD(Sheet.40!FillForegnd) where Sheet.40 is the original tag.

Everything works great until I attempt to move the clone to a different page.  The reference is broken and the formula now looks like GUARD(REF()).  I have attempted to incorporate the page reference into the formula:

FillForeGnd = GUARD(Pages[Sheet-1]!Sheet.40!FillForegnd)

I am able to create a reference of this type when entering the formula into a clone that is on a different page than the master tag.  The formula will take and the changes to the master tag effect the clone as well.  However, when attempting to enter the formula into a clone when the master tag is on the same page, the Pages[Sheet-1] is lost.  My hope had been that if I could capture the page reference that moving the clone to a new page would retain the page reference but it won't take when they are on the same sheet.  Likewise, when creating the page reference on a clone on a different page, moving the clone to a new page loses the reference as well.

Is there a way to include a page reference in shapesheet formulas that I am overlooking that might be more effective and resilient?

Thanks

wapperdude

Visio automatically "wipes" the Pages[Page-X]! from the formula when the shape is on Page-X.  I'm not aware of any shapesheet work-around to overcome this.  I suspect the only automatic solution is to use a macro which puts the desired formula in the shapesheet and puts the cloned shape directly on the desired destination page.  If the shape touches the same page as referenced by the formula, Visio will wipe it clean.

Wapperdude
Visio 2019 Pro

Yacine

Store the page name of the source shape as static value in the clone shape, then rebuild the formulas when they are dropped on a different page via SETF/getRef.
Yacine

DavidJT

Thank you, Yacine.  I will try to make a User.GlobalTarget field that contains a text string with the page and shape reference.

DavidJT

I played with this some more based on the suggestion to statically store the page values.  The most significant issue would be that the static values would not account for a page being renamed.  The secondary issue is that to link dozens of shapesheet properties in this manner would require creating dozens of user-defined fields to SETF(GETREF(...)) each properties.  I'm not finding that the formulas are able to resolve a page name stored as a string into a page reference and there is no way that I can see to create a reference to a page.

I think I will simply resign that application to only considering cloned tags to the local page.

Yacine

Hi David,
for both problems there are workarounds.
1) Page being renamed.
The page names already in use by the clones should update automatically, as they are no longer static.
The static page name in the source shape can be updated by an additional "+dependson(pagename)".
2) Too much formulas: You use the data of the source shape only for display.
So it would make sence to concatenate all the desired data in 1 field. Line breaks to be added as chr(10).
Yacine