Join External Table to Revit Database

4 Feb

In my last post, I showed how to filter a table by creating a view and bringing that view in to your MVC Application. You can also join tables. In this post, I will show how to join Revit data to an external Database.

The Database

I export my Revit model to a database called RevitSample. While it appears that I can add additional tables and Revit will not overwrite them, it is probably best to stay out of the tables in the Revit Database. To avoid corruption of my Revit DB, I will create another database called AdditionalData. I will also add a table called MoreData. Below is an image of the Databases and the Table.

MultipleDBsTable

Joining

I now have a table that has room numbers which coincide with the numbers in my Revit Rooms table. Any data in this table can be joined to the Revit table using number as the join field. to create the join, I add a new view and enter the sql shown in the image below.

JoinFromOtherDB

MVC Application

The additional data has been added to the Revit View. I can now create an MVC application and load my view as the model. When I am done, I will have a table like the one in the image below.

TablesJoinedInApp

While you can view this table, because there is no primary key in the view, you cannot edit. There appear to be workarounds, but while I can make the errors go away, the save function does not work. This is acceptable as editing should take place in the correct table, not a view.

Why

why would you want to do this? I spent many hours typing data in to Revit because we needed it in a Report and we could get it from the schedule. Being able to join the data, I can load the outside data in to a table and join it. Then I can export it to my application and it is in a schedule or report. The Revit model remain untouched and my outside data can change and if it gets corrupted, my model is safe. As long as I do not need the data in Revit to generate plans, why not attach it later. I can still query it as if it is in the same table and generate all my reports and schedules. Revit doesn’t exactly create pretty schedules for reporting purposes, so why not use the Database to do it for you using something like Crystal Reports?

 

Advertisements

One Response to “Join External Table to Revit Database”

Trackbacks/Pingbacks

  1. Weekly Roundup – 2015.05 | The BIMsider - February 6, 2015

    […] Join External Table to Revit Database […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: