• 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 / Visio 2010 / Visio 2010 Validation Rules (part 1)

Published on September 16, 2009 by David Parker

Visio 2010 Validation Rules (part 1)

The Microsoft Visio team recently blogged about Creating custom validation rules for Visio 2010 , in which it was suggested that we can use Visual Basic for Applications to interact with the new validation API.  I thought, there’s a challenge … so I will develop a VBA project to do just that.  I will upload the code soon, but, as it is only half developed today, I will demonstrate how to understand why a rule has been broken.

In the following BPMN diagram, I have failed to connect a Task to the End Event.  I have made it obvious here but it could be easy to overlook in a larger diagram.  In fact, I know of one company who were advised by a “consultant” that there must be something wrong when the end of a connector goes red therefore you should move it away from the shape until it goes green!  The result was that the company had over 300 flow diagrams without a single valid connection!  That company is no more!

image

The new UI in Visio 2010 has a new Process tab, which has a button to Check Diagram and a tick box display the Issues Window.  This shows that two rules have been broken, but it does not give you any more than the rule Description and Category.  Now, you may assume that Microsoft have the BPMN rules modelled correctly, but if you are creating your own rule sets, then you need to understand exactly why they have been broken, therefore I have constructed a basic VBA dialog that displays the Issues and Rules in a selected document.

Issues

So, when an Issue is read from the new document.Validation.Issues collection

Issue 1 has the rule with the description An End Event must have incoming Sequence Flow. has the name NoSequenceFlowToEndEvent , and the category of End Events .

Issue 2 has the rule with the description The flow must have a source and target. has a name NoTargetOrSource, and a category list of Sequence Flow, Message Flow .

image

Rules

The Name, Description and Category of the Rule, cannot be sufficient to define what the rule is, so we must explore the Rules of the active RuleSet in the document.  In this case it is the BPMN RuleSet, which contains many Rules, and using my dialogue, I can find the Rule with the name NoTargetOrSource to see what it’s definition is.

image

Now we can begin to understand how a rule is defined by inspecting the Test Expression and Filter Expression values.

TestExpression=AND(AGGCOUNT(GLUEDSHAPES(4))=1,AGGCOUNT(GLUEDSHAPES(5))=1)

FilterExpression=OR(Actions.MessageFlow.Checked, Actions.SequenceFlow.Checked)

These expressions look very similar to ShapeSheet formulae, but they are not actual ShapeSheet formulae.  However, some ShapeSheet functions can be used in these expressions, but Microsoft have had to create some extra quasi-ShapeSheet functions that are needed in order to create a rule definition.

Closer inspection of the FilterExpression shows that this rule is only to be applied to shapes which have either an Actions.MessageFlow or Actions.SequenceFlow row checked.  The Dynamic Connector in the BPMN template has been modified to have such rows in the Actions section of the spreadsheet.

image

If you now look at the TestExpression reveals that the new GluedShapes method, as seen in my previous post Listing Connections in Visio 2010 , returns an array of glued shapes .  The arguments 4 and 5 are the actual values of the constants visGluedShapesIncoming2D and visGluedShapesOutgoing2D respectively.  The function AGGCOUNT() obviously means the count the number of items in the retuned array, so the whole expression simply says that there must be a connected 2D shape at either end of the connector.

The other broken rule, NoSequenceFlowToEndEvent, has :

TestExpression=AGGCOUNT(FILTERSET(GLUEDSHAPES(1),”Actions.SequenceFlow.Checked”))>0

FilterExpression=AND(HASCATEGORY(“Event”),Actions.End.Checked)

Inspection of these expressions reveal that it applies to and shape that has the category “Event”, and has the row Actions.End checked, and it must have a glued connector which has the row Actions.SequenceFlow checked.  I discussed the new ShapeSheet function HASCATEGORY() in my earlier blog Visio 2010 : Containment and Cross-Functional Flowcharts, but the other new function is FILTERSET() obviously means that the returned array of GluedShapes is filtered to include only those that satisfy the second argument, in this case, Actions.SequenceFlow.Checked.

Once you start examining the rules, you can begin to understand how you can create your own ones.  Getting interested?

Related

Filed Under: Validation, Visio 2010

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

Trackbacks

  1. Writing rules to validate diagrams in Visio 2010 – A worked example | bVisual - for people interested in Microsoft Visio says:
    December 31, 2018 at 9:17 am

    […] Visio 2010 Validation Riles (Part 1) […]

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

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 Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams 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
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

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