Filtering Lists based on shape selection using Visio Web Access

I’ve been looking into the options of using Visio Web Access to link Visio objects to SharePoint data. Now that its possible to capture shape data and use it to filter web parts there is a an opportunity to supplement Visio diagrams with contextually relevant information.

In my example I want to show how it is possible to use the selected Visio shape to filter a SP list to display contextually relevant information on the fly.

The list I have created has supplementary information that might be useful to the diagram – please note I made it up very quickly and should not reflect any system design! You can mock-up something similar to the list shown below or anyones interested I could upload it as a list template – just ask.

For this example I have also created a very simple Visio diagram of ‘entities’ which we are going to use as our filter criteria. Create a new Visio diagram and drop on a couple of shapes – it really doesn’t matter what type they are.

The main thing here is the Shape Data – if you are familiar with adding Shape Data  simply define a new data property called ‘Entity’  and type the entity name into the shape information panel.  For those you don’t know what I mean by this, see the steps below.

Right click the shape and select ‘Define Shape Data’. Remove any existing data properties and add a new one called ‘Entity’ as per the diagram below (removing the ‘Order’ text under Value as this is specific to the shape and is added in a later step).

Now with the ‘Shape Information Panel’ you should see the ‘Entity’ data property with a blank value and you can enter the entity value for each shape – which in this example is the same as our shape name. If you don’t know where the Shape Information Panel has got to, enable it by selecting ‘Task Panes -> Shape Data’ from within the ‘View’ ribbon.

At this stage you are possibly wondering why you can’t simply use the Shape Name – doesn’t  the Visio Web Access surface this by default?

Well yes it does but in my tinkering I could not find a way for the Shape Name to correctly filter the list using the Shape Name and after many attempts decided to follow the approach of using custom shape data. If you have figured out a method of using the Shape Name to filter then I’d love to know – hopefully it’s not just something within my environment!

Before moving on make you to add entity values for all your shapes using the shape information panel.

Save the example diagram as a Visio Web Diagram (*.vdx) using the ‘Save As’ function and upload to a document library on SharePoint.  The source data is now created so move on to creating the page and making the filter connection.

Create a new page either using web interface or SP Designer and add two web parts: Visio Web Access and the list you created earlier. I will run through the web interface method below.

Select ‘Site Actions’ -> ‘More Options’ and select ‘Web Part Page’

Select ‘Full Page’ Filtering as your layout, enter a name for your page and click ‘Create’

You will be looking at a blank web part page with a big button to ‘Add a Web part’.

First add the ‘Visio Web Access’ web part which will act as your placeholder for your Visio diagram.

Click the link that says ‘Click here to open the tool pane’ and either paste in the Web Drawing URL to the saved .vdx you uploaded earlier or navigate to it like below.

QUICK TIP: The ‘Override Web Drawing’s default initial view’ option in the web part settings (second configuration option) should be disabled if you are using a diagram with multiple tabs. Despite what you might infer from its name, when enabled, it always refreshes the diagram back to the first tab with each shape selection. My suggestion is to disable this option unless you specifically need the functionality or are using a diagram with only one tab.

The other web part option that needs to be set before we can move on is the ‘Expose the following shape data..” field.

Because we are using custom shape data to filter (i.e. not Shape Name, Shape ID etc) we need to tell the web part to expose this data in order to use it in our connection. In this field type in ‘Entity’ if your following my example, or the name of the data property you created in Visio. We can now use this value to send as a filter to our list web part.

The go back and add another web part for the list you created earlier. This is done by selecting the list from ‘List and Libraries’ Category. It must be pointed out that the list must exist in the same site for this method to work. If your list is in another location or SP Farm then you will need to build a Data View Web Part like I have run through in this article.

Now that both elements are on the page we can set up the web part connection to send the filter value from one to the other.

Make sure the page is in edit mode and select the web part settings drop down for the Visio Web Access web part and select ‘Connections’

The connection type we wish to make is the ‘Send Shape Data to’ which will send the value of the selected shape to the list.

This will bring up a new window with the two-step connection wizard.

Select the ‘Get Filter Values From’

Then select ‘Entity’ in both the provider and consumer field. Essentially you are defining what value is being passed from the Visio web part (in this case our entity shape data value) and the consumer field defines what column on the list is to be filtered based on this value (and again in this example it is also the entity column).

Now the connection is set up, when we select a shape on the diagram it passes the entity name from the shape data to list web part and filters the list accordingly.

In my example I’ve attempted to show how web part connections can be used to supplement an entity relationship style diagram with information from a SP list but this is just one of many possible applications. Now that you can capture ANY type of shape data and pass this to ANY web part – the doors really do open.

Currently I am looking into a documentation system that uses such references to make a set of interactive, highly linked and contextually relevant document with as little content management as possible. I will post more in this space as it progress but this article should prove to be a useful starting point.