Author Topic: Referencing values over multiple pages in a document  (Read 270 times)

0 Members and 1 Guest are viewing this topic.

Another_Noone

  • Jr. Member
  • **
  • Posts: 58
Referencing values over multiple pages in a document
« on: July 05, 2019, 05:11:00 AM »
Im creating a visio template to provide a preset drawing background with logos, rams, a header etc.

Im trying to set text fields in a document header to certain values which can be set in the first page's (data page) shape data.

I tried two ways of doing this, which resulted in two different (but equally annoying) bugs.

The first way (which you can see in the example template)  is this:

Shape Data for the first page exists, values can be set there.
User defined cells in the TheDoc Shapesheet are set to Pages[Projektdaten]!ThePage!Prop.xyz (which sets them to the same value as the shape data of the data page.
Then text fields which should show the data are set up with =TheDoc!User.xyz and show the data.

Problem with this solution is: when creating new shapes etc. and trying to copy them into stencils / other documents you get "Error 318 - Prop.Value[26]".

Second solution i tried:

Text fields directly reference the Shape Data of te data page. This works (no Error 318), but i get a rather funky bug:

When creating a new document by opening the Template (not edit, just open), and NOT viewing every single page in the document once before saving the next time you open the document, values won't update anymore, the formulas are still intact though.

Since both of these ways seem to produce some sort of bug Id like to, well, not have, Im asking if someone has another idea on how to do this.
Another_Noone

Just some weirdo on the Interwebs.

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2798
    • Paul Herber's website
Re: Referencing values over multiple pages in a document
« Reply #1 on: July 05, 2019, 07:42:18 AM »
I have no problem creating a shape in a stencil that references a doc user variable ... document and stencil attached
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Another_Noone

  • Jr. Member
  • **
  • Posts: 58
Re: Referencing values over multiple pages in a document
« Reply #2 on: July 05, 2019, 07:58:06 AM »
Quote
Error #318 can occur when you copy and paste a shape from one document to another.  There are some specific circumstances needed to trigger the error:

    The shape is an instance of a master

    The shape has a reference to a cell in the Document Shapesheet

    The cell in the Document Shapesheet has a reference to another cell [in the Document Shapesheet]

    The Document Shapesheet cells are not present in the target document

I feel like this triggers the error on my end though.
Another_Noone

Just some weirdo on the Interwebs.

Another_Noone

  • Jr. Member
  • **
  • Posts: 58
Re: Referencing values over multiple pages in a document
« Reply #3 on: July 05, 2019, 08:01:15 AM »
This explains this problem more in-depth.

Quote
The problem for Visio is the secondary reference in the Document Shapesheet to another cell.  Normally when a shape moves between documents, Visio automatically copies over the page and document cells that the shape depends on – creating them if necessary.  Visio sees that the shape being copied has a reference to cell User.Test1 in the Document Shapesheet, and it creates this cell in the target document.  Visio does not know that the contents of cell User.Test1 themselves have a reference to another cell.  Cell User.Test2 is not created in the target document.  When Visio tries to complete the Paste operation and recalculates the cells, it finds that there is a missing reference.  Error #318 is shown and the Paste operation fails.

Quote taken from https://surrogate-tm.github.io/visio//2006/07/14/error-318-explained.htm
Another_Noone

Just some weirdo on the Interwebs.

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2798
    • Paul Herber's website
Re: Referencing values over multiple pages in a document
« Reply #4 on: July 05, 2019, 08:31:14 AM »
Can you not just add a direct reference to the doc level cell somewhere within the shape, say in a Scratch cell? Would the doc level cell then be created?
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Another_Noone

  • Jr. Member
  • **
  • Posts: 58
Re: Referencing values over multiple pages in a document
« Reply #5 on: July 05, 2019, 08:39:46 AM »
Im not quite sure, ill try that

The weirdest part about this problem, is that while it happens in Documents with references to thedoc etc. the shapes i tried to copy/paste in/out dont have references to thedoc.
« Last Edit: July 05, 2019, 08:41:30 AM by Another_Noone »
Another_Noone

Just some weirdo on the Interwebs.