Reference for External Database Links

You can use the following Autodesk Navisworks tags with SQL queries:

Property Tags

%prop("category","property")

Property of the currently selected object. Category is the name of the tab in the property windows (for example, Item or Entity Handle) and property is the name of the property in that tab (for example, Value or Layer).

%intprop("category","property")

Property of the currently selected object. This is the same as the previous tag except instead of using the publicly visible category and property name use the internal Autodesk Navisworks names. The benefit of using internal names is that they are not language dependent. This is advanced tag suitable for users familiar with the Autodesk Navisworks API.

File and Path Tags

%sourcepath

This tag represents the full path and filename that the currently selected object comes from. Even when a collection of model files have been combined into a single NWD file this tag still remembers the path and filename of the original model file.

%currentpath

This tag represents the full path and filename of the currently loaded model. If you currently have an NWF or NWD loaded that contains many other models it will just return the path and filename of the top level NWF/NWD.

File and Path Manipulation Tags

%removeext("text")

If the provided text includes a filename with an extension, this tag removes the extension.

%removepath("text")

If the provided text includes a path and filename, this tag remove the paths and just returns the filename.

%poppath("text")

If the provided text includes a path, this tag removes the top level. If it the text also includes a filename, it counts as the top level and is removed. For example, %poppath(“c:\temp”) becomes c:\ and %popath(c:\temp\readme.txt”) becomes c:\temp.

%pushpath("text1","text2")

If text1 is a path and text2 is a file or folder name, then text2 is added onto the path in text1. For example, %pushpath(“c:\test”,”model.nwd”) becomes c:\test\model.nwd.

String Manipulation Tags

%join("text","text")

This tag simply joins the two pieces of text together. For example, %join(“c:\”,”model.nwd”) returns c:\model.nwd.

Query Examples

The examples below illustrate how tags could be used with SQL queries.

  • Selecting all columns from table Test whilst requiring that the column called Entity Handles matches a category/property pair called Entity Handle/Value and the column called File Name matches the original filename of the drawing:

    SELECT * FROM Test WHERE "Entity Handle" = %prop("Entity Handle","Value") AND “File Name” = $removeext(%removepath(%sourcepath));

    Here the path and the extension of the file name are being stripped, so a file like c:\model\3rdFloorDucts.dwg would come out as 3rdFloorDucts.

  • Selecting two columns from table Test whilst requiring that the column called Entity Handle matches a category/property pair called Entity Handle/Value:

    SELECT Name,Part FROM Test WHERE "Entity Handle" = %prop("Entity Handle","Value");

  • Selecting all columns from table Test whilst requiring that the column called Value is within a certain range given by two category/property pairs:

    SELECT * FROM Test WHERE Value BETWEEN %prop("Pressure","Minimum") AND %prop("Pressure","Maximum");

Note: Tags must not contain white space between the brackets (unless enclosed by quote marks), so %prop("EntityHandle","Value") works, but %prop("EntityHandle", "Value") does not.