Connecting your Navisworks model to a database can be a maze for the non-expert. Working in support I get asked alot about DataTools connections, linking to Excel, Access, Text files, SQL Databases and more. It's a difficult area, we want to provide the best help we can, but you know the data better than we do, you know the environment you are on, due to the amount of variables we can only guide you. Any changes to that environment or data can kill the connection to your model, so here's some guidance for those working with DataTools to get it set up.
We ALWAYS recommend that you know SQL and the database you are connecting to, otherwise you'll get lost quite easily. Get your IT department involved if you do not know how to connect to the database yourself.
- If this doesn't work outside of Navisworks, it definitely won't work inside Navisworks
- We will only recognize 32 bit ODBC drivers on 32 bit machines, if you have a 64 bit machine; you need a 64 bit ODBC driver
You will need a suitable ODBC data source for your type of database (Excel, Access, Text, CSV), this needs to appear in Administrative Tools > Data Sources. These can either be pre-configured as a DSN or used directly via the driver.
If the source appears in one of the DSN tabs then there should be a wizard to set up the connection string supplied by ODBC. When setting up a new DSN, this wizard should create a working link to the database. The menus to create the connection will vary from driver to driver as well. You can refer directly to this DSN through Navisworks, in which case there is no further connection configuration needed.
Alternatively you can also set up a connection directly in Navisworks using the ODBC driver itself, if you select a driver in the ODBC Driver field in DataTools, clicking setup will launch the same wizard as used to make DSN's in Windows. This allows you to configure the connection directly in Navisworks.
Once you have a connection string configured you still need to specify how the database will be queried. This is done via an SQL SELECT Query.
This would typically be comprised of three parts, but will vary depending on your precise needs. Our examples will assume a simple use case accessing a single table.
There's whole books and websites dedicated to creating SQL strings, and because of the huge variety of ODBC Drivers available, and Data that can be linked to, we cannot give an explicit 'this will work' sample for you but here is a simple single table Access query to get you started. When actually entering this in DataTools this needs to be a single line terminated with a semi colon.
SELECT (this is where you enter the field names you want to query) FROM (this is the name of the table) WHERE (this is where you enter the condition for which data to bring through – typically this would include a Navisworks tag which fetches model data to participate in the condition);
SELECT weight FROM entity_data WHERE name=%prop('Item','Name');
This assumes a table called entity_data with two fields, weight and Name, where Name is the same as the Name of Items in the Navisworks model, %prop is one of the tags that can be used in an SQL string in Navisworks DataTools to retrieve model data for conditional matching, more can be found in the Help file in the product.
Once you've got fields selected by your SELECT statement, to get them to show in Navisworks, you have to list the fields with a display name in the right-hand pane of DataTools.
If you have any tips, or recommendations specific to different files types, please Submit a Tip