Visio Guy

Visio Discussions => Programming & Code => Topic started by: dakndor on February 01, 2023, 08:39:26 AM

Title: Shapesheet Formula to reference data on separate page in document
Post by: dakndor on February 01, 2023, 08:39:26 AM
Hi All

I am working on automating some functions in our visio drawings to make things easier and I've hit a wall with referencing on a shapesheet.

I'm pretty used to inserting typical references for shape data that's on the same page, for example

Quote=(Prop.PRJ_NUM)&"-A-"&PAGENAME()&"-"&Sheet.1041!Prop.DWG_NAME

Which pulls together some user entered data in different shapes to build a file name.

What I am struggling with specifically is I would like to be able to call the Prop.PRJ_NUM from a shape that lives on a separate page within the document.  This would mean users can enter project info on this page when starting the file and then as they add pages to the document it automatically populates across.

I can't for the life of me work out how to get this reference to work and feel like it's either bordering on the impossible or I'm just missing something here.

Can anyone help?

Thanks in advance!
Title: Re: Shapesheet Formula to reference data on separate page in document
Post by: Surrogate on February 01, 2023, 09:19:10 AM
Quote from: dakndor on February 01, 2023, 08:39:26 AMWhat I am struggling with specifically is I would like to be able to call the Prop.PRJ_NUM from a shape that lives on a separate page within the document.
You can use syntax like Pages[PageName]!SheetName!CellReference.
Read more about cell references (https://learn.microsoft.com/en-us/office/client-developer/visio/about-cell-references)
But you must remember about local and universal names problem!!!
Quote from: Surrogate on August 14, 2021, 05:57:18 AMDid you rename pages in this documen more than one time?
https://techcommunity.microsoft.com/t5/visio-blogs-archive/name-and-nameu/ba-p/237259 (https://techcommunity.microsoft.com/t5/visio-blogs-archive/name-and-nameu/ba-p/237259)

Read more about local and universal names (Name/NameU) problem!

Quote from: Nikolay on May 18, 2019, 09:28:18 PM
May this confusion come from Name and NameU?
See, each shape has two names. One you can see in the UI (in the "Shape Name" window for example or the drawing explorer).

Another one (NameU) is hidden. But when you name a shape for the first time, using the dialog, both names are set.
But later on, if you modify the "public" name, the "hidden" NameU is not modified.

Note that in the ShapeSheet formulas, you can only use the "hidden" NameU to refer to a shape.
Title: Re: Shapesheet Formula to reference data on separate page in document
Post by: dakndor on February 03, 2023, 12:04:10 AM
Yes! Thanks Surrogate!

That has sorted it for me.  Looks like I've got a bit of reading to do this weekend!
Title: Re: Shapesheet Formula to reference data on separate page in document
Post by: Surrogate on February 03, 2023, 06:49:42 AM
Quote from: Surrogate on May 21, 2020, 01:13:25 PMHope my Snippet for ShapeSheet (https://surrogate-tm.github.io/snippets/shapesheet_en.html#ref) can helps you
Please try this way!