Lookup Tables Explained

Lookup Tables Explained

The Art of the Lookup Table

Traditionally Lookup Tables are used in Pipe, Conduit and Duct Families to automatically size all the instances parameters. But they can be used by all Families that utilise lots of instance parameters as opposed to complex formulas.

Let’s examine the Syntax of a Lookup Table Formula

 

Tips-LookupTables.png
Lookup Table Structure

The first 3 parts are pretty self explanatory, it’s the “LookupValues” which can be confusing as it’s the syntax doesn’t make it obvious how the columns are mapped. We’ll look at a Lookup Table and an example formula which will help in truly understanding the structure.

Let’s examine the Structure of the Lookup Table in Microsoft Excel

The Excel File should look like below. It can then be saved as a CSV (comma separated).

Ensure you choose CSV (Comma separated) as there are multiple CSV formats.

 

image-20240314-012910.png
Lookup Table CSV in Microsoft Excel

 

image-20240314-013046.png
Parameters in Revit

From the Formula we can see that it uses the value of the “Nominal Diameter” and matches the value to the “ND” column. As this is currently set to 250mm, it matches to row 10, we can see the LookupColumn in the formula is “THK” column, so it selects the value from here being 114. Note there is nothing in the formula that says Nominal Diameter explicitly maps to ND clearly. Instead its more the fact that it maps to the first parameter column.

You can also map to multiple columns. EG: We might need to lookup the Nominal Diameter and another parameter, then find the corresponding column where they both match. What is shown is the simplest form. For example a pipe elbow may need to lookup the pipe diameter and the angle of the elbow to get the socket length.

Make sure the columns you wish to use as “LookupValues” are in order in your lookup table. Using the elbow example the order of columns in the table after the first column should be NominalDiameter##LENGTH##MILLIMETERS, FittingAngle##ANGLE##DEGREES

 

If you want to use a lookup table to set the value of an integer parameter, use the following in the table header: <parameter name>##NUMBER##GENERAL

If you want to use a lookup table to set the value of a text parameter, use the following in the table header: <parameter name>##OTHER##

 

for Yes/No parameters, use a formula something like this
image-20240326-234554.png
here the size_lookup returns a value of 0 when no size is found, and that is compared to the value 0 which when no size is found evaluates to 0=0 which will return a result of True or Yes.

 

size_lookup can be used in type parameters if “LookupValues” are also type parameters. This can be useful instead of using a large nested if statement. Think of it as an IFS statement in Excel

 

  1. Create your Lookup Table in Microsoft Excel. The columns labels need to have units similar to a type catalog. The first column is used to nominate the Models or some descriptor that might help you remember what each row represents.

  2. In Family Types choose Manage Lookup Tables.

    image-20240314-020105.png

     

  3. Choose Import… and select your newly created Lookup Table.

  4. Select OK.

  5. Create a New Text Parameter called Lookup Table Name.

  6. Set it’s value to match the Name of the Lookup Table (don’t include the file extension)

  7. Your Lookup Table is now ready to use for the Parameters its required. Add the size_lookup formula to each of the relevant instance parameters.

Related articles