• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Visio / Referencing Container Data in Visio

Published on February 28, 2022 by David Parker

Referencing Container Data in Visio

Microsoft Visio has a useful Structured Diagramming concept that consists of Containers, Callouts and Connectors. The first of these features make it possible for shapes to know what they are contained within, as a better option to grouping shapes together. Grouping can hide or break the grouped shapes smartness, so Visio provides two ways of allowing shapes to be members of one or more containers. There are a few built-in Container shapes that can be added with the Insert / Diagram Parts / Container gallery, but shape developers can also create their own. Member shapes can be positioned anywhere within the container. There is a second type of container, List, that provides the ability to have ordered member items. There is no ribbon command to add these, but there are a number of these special shapes provided in the OOTB Visio stencils. For example, dragging and dropping a List box shape from the Software and Database / Software / Controls stencil will automatically add three List box item shapes to it.

There is a dedicated ribbon tab, Container Format, that appears when you select a container shape, which provides some extra commands, but I want to demonstrate how a member shape can reference data in its container shape in the ShapeSheet. I edited the Belt and List box masters in the Document Stencil above by adding a Title Shape Data row. Of course, I also ticked the Master Properties / Behavior / Match master by name on drop option to prevent Visio creating duplicate masters. I also ticked this for List box item master because I want to edit that too.

First, I simply added a Shape Data row to each master, but made them read-only so that they displayed the text in the heading shape of each.

The Belt master’s heading shape is Sheet.8, so the Prop.Title.Value cell formula is:

=GUARD(SHAPETEXT(Sheet.8!TheText))

The List box master’s heading shape is Sheet.6, so the Prop.Title.Value cell formula is:

=GUARD(SHAPETEXT(Sheet.6!TheText))

Next, I edited the text of the List box item master by using Insert / Field:

The following formula will either display the position of the item within its List container, or it will display that it is #0 of no list.

="#"&LISTORDER()&" of "&IFERROR(LISTSHEETREF()!Prop.Title,"no list")

The LISTORDER() function will return the position in the list, and LISTSHEETREF() function gets a reference to it. The ISERROR(…) function provides the fallback value if the specified cell does not exist in the referenced list container, or if there is no list container at all. The list container could also make use of the LISTMEMBERCOUNT() function if you wanted to display that.

The rectangle shape text was also edited to display the Title Shape Data of its container.

This is the simplest form of the CONTAINERSHEETREF(…) function, because it simply references the first container it is within:

"I am in "&CONTAINERSHEETREF(1)!Prop.TITLE

Of course, the CONTAINERSHEETREF(…) expression could also be enclosed within an IFERROR(…) function, to handle the case where there is no container. In addition, the CONTAINERSHEETREF(…) function has an optional second argument to filter the collection by a named shape category. There is also a CONTAINERCOUNT() function to get the total number of containers that a shape is within, and a CONTAINERMEMBERCONT() function for a container to get the number of members that it has.

Note that I had to re-drop a List box item shapes to use the new text formulas automatically.

These functions are also used extensively in Cross-Functional Flowchart diagrams, where multiple container shapes (swim-lanes) are found within a list shape. All of this functionality works in Visio for Web, so there is no excuse on making smart shapes for everyone!

Using Notepad++ to Edit Visio ShapeSheet formulas

Visio shapes get their smartness from the formulas that are entered into the ShapeSheet, but editing these formulas can be extremely tricky and prone to error because of the lack of a modern programmer’s interface. Formulas can be quite long (up to 64k characters) but even medium size ones like the one in User.GetWorkdays cell…

Adding a second Function header bar to Visio swimlanes

I was recently asked if a second function header bar can be added to the swimlanes in the cross-functional flowchart templates in Visio. Some swimlanes can get quite wide, so it can be useful to have a duplicate function header shape on the far-side too. It is quite simple to duplicate the existing function header…

More Parsing XML Data in Visio Shapes

My last article looked at parsing an XML string with a known structure and order of elements and attributes. This can be acceptable in some scenarios, but what if the elements or attributes are in a different order? Then it is necessary to use the element and attribute names rather than their index position. This…

Parsing XML data in Visio Shapes

One of my current projects uses XML data, and some of the values in the XML data control the display and content of Visio shapes. Therefore, I looked deeper into how the XML data can be used directly to control parts of the graphics. Although the external data linking feature in Visio Professional and Visio…

Highlighting dirty text in Visio shapes

I suppose I should explain what I mean by dirty text first 🙂 I often display the value of a Shape Data row in Visio text, but sometimes the solution requires that the value is also editable. This is ok if the client accepts that all editing is done with the Shape Data window or…

My new book on Visualizing Processes with Microsoft Visio has launched

Back in the early 1990s, there was an application called ABC Flowcharter that was the market leader for diagramming business flowcharts, but some of the brains behind Aldus PageMaker saw an opportunity to create something smarter, and left to write the Visio product, with the stated aim to overtake ABC Flowcharter within 2 years. They…

Related

Filed Under: Containers, Lists, ShapeSheet Formulas, Visio Tagged With: Containers, Lists, ShapeSheet Functions, Visio

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. Bogdan Stefanescu says

    November 21, 2022 at 2:14 pm

    Hi David,
    please, if you can, tell me what book or tutorial I should buy to learn how to make a business process simulation in Microsoft Visio. After I map the processes and highlight the cost and time elements in Shape Data, I need Visio to automatically calculate the costs, times and other characteristics of a process from Start to End.
    Thanks

    Reply
    • David Parker says

      December 19, 2022 at 11:22 am

      Calculation from Start to End depends upon the route taken through the process. You can build in many types of calculation into Shape Data, but are you trying to calculate all of the different options?

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Using Notepad++ to Edit Visio ShapeSheet formulas
  • Adding a second Function header bar to Visio swimlanes
  • More Parsing XML Data in Visio Shapes
  • Parsing XML data in Visio Shapes
  • Highlighting dirty text in Visio shapes

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Themes Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • Amazon
  • Email
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Using Notepad++ to Edit Visio ShapeSheet formulas
  • Adding a second Function header bar to Visio swimlanes
  • More Parsing XML Data in Visio Shapes
  • Parsing XML data in Visio Shapes
  • Highlighting dirty text in Visio shapes

Copyright © 2023 · Executive Pro on Genesis Framework · WordPress · Log in