• 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 / Using Visio and PowerBI with GraphDatabase in SQLServer – Part 2

Published on February 12, 2018 by David Parker

Using Visio and PowerBI with GraphDatabase in SQLServer – Part 2

In my last article, I described how Visio can be used to input Nodes & Edges into a SQL Server graph tables (see Using #Visio and #PowerBI with #GraphDatabase in #SQLServer). In this article, I show how PowerBI can be used to create an Excel table that can then be used to automatically create a Visio diagram. This diagram can then be enhanced for reports and presentations, or used to check the validity of nodes and relationships. The shapes can then be used to update or delete edges and nodes in the database.

In the above example, the PowerBI table visual is filtered by the other visuals to provide a list of Nodes and Edges. The PowerBI web app can then export this table to Excel, which can then be read by some code in LinqPad (as this is just a prototype), and the Nodes and Edges can then be automatically added to the active Visio page. As this is just a proof of concept, I left the code un-optimised so that the progress of the shapes being added to the page and being connected can be seen. This would, of course, be much quicker in a finished application. Also, I have not bothered with any nice icons either, but this could also be a simple enhancement.

RecreatingFromFilteredList

Although I have used a Force-Directional visual in Power BI,  I am sure there are others that would also be useful. All I was interested in for this example was to be able to create a filtered list in a suitable form for use as a source for creating a partial graph diagram in Visio. In fact, Cypher Queries can also be written to produce tables of Nodes and Edges that could be used to create Visio diagrams too.

Deleting Nodes & Edges

DeletingNodesAndEdges.gif

Of course, now that I have created a simple way to create Nodes & Edges, then I can more easily create mistakes. So, it is also necessary to be able to delete them.
To do this safely, I assumed that no Node should be deleted if it has any Edges. Therefore, selected Edges need to be deleted first, and then the Nodes can be deleted if there are no remaining Edges. I also decided that, rather than delete the shapes, that I would simply remove the Data Graphic. Thus it is easier to re-insert the shapes back into the database, if desired. A possible enhancement is to add a Status shape data row to each shape, so that this could be changed between, say, In DB and Not in DB. These values could then be used to Color by Value or apply a Data Graphic Icon Set.

I could not find an example of deleting Edge rows, but I managed to write some dynamic SQL in LinqPad, eg:

 var results = ExecuteQueryDynamic($"DELETE FROM [{ens.Edge}] " +
 $"Where $from_id = (SELECT $node_id FROM {ens.Node1} WHERE id = {ens.Node1ID})" +
 $"And $to_id = (SELECT $node_id FROM {ens.Node2} WHERE id = {ens.Node2ID})");

In this example, my ens object is the values read from the selected Visio Dynamic connector/Edge shape. So, ens.Edge is the Edge table where the row is stored.
There are some limitations to the current SQL Server implementation of Graph objects, such as Edges are mono-dimensional, but I think it is an exciting progression. I also think that a little custom code for Visio can create an effective tool for entering, deleting and displaying information within the database. All I need now is a real project to develop a proper solution for!
 
 

Related

Filed Under: Graph Database, PowerBI, SQL Server, Visio, Visio 2016 Tagged With: Excel, GraphDatabase

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. Using #Visio and #PowerBI with #GraphDatabase in #SQLServer | bVisual - for people interested in Microsoft Visio says:
    February 12, 2018 at 12:18 pm

    […] Using #Visio and #PowerBI with #GraphDatabase in #SQLServer – Part 2 […]

    Log in to Reply
  2. [Reference] Power BI blog posts – the (almost) complete list 2018 – Bonjour Joël says:
    February 12, 2018 at 9:58 pm

    […] Using Visio and Power BI with GraphDatabase in SQL Server – Part 2 […]

    Log in to Reply
  3. Using #JSON text in #Visio shapes | bVisual - for people interested in Microsoft Visio says:
    February 13, 2018 at 9:29 pm

    […] Using #Visio and #PowerBI with #GraphDatabase in #SQLServer – Part 2 […]

    Log in to Reply
  4. Creating #Visio #Validation Rules for #GraphDatabase template | bVisual - for people interested in Microsoft Visio says:
    February 14, 2018 at 9:36 pm

    […] Using #Visio and #PowerBI with #GraphDatabase in #SQLServer – Part 2 […]

    Log in to Reply
  5. Using #Visio with SQL Server #Graph Databases – April Update | bVisual - for people interested in Microsoft Visio says:
    April 10, 2018 at 7:58 pm

    […] Using #Visio and #PowerBI with #GraphDatabase in #SQLServer – Part 2 […]

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Co-authoring and Commenting with Visio Documents
  • 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

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

  • Co-authoring and Commenting with Visio Documents
  • 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

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