Plant SDK: Sample of PnPTable.Select()

By Marat Mirgaleev

Issue

What if I want to apply a selection filter to PnPTable.Select()?

Solution

One of the PnPTable.Select() overloads accepts a filter string as a parameter in a form of the SQLite’s SELECT-WHERE clause. Please, note the syntax of the expression: if the field name contains spaces, it must be enclosed in quotes. The value is enclosed in apostrophes (you can find the escape sequences description in the SQLite documentation, if you search it online).

In this sample we are trying to use the PnPDrawings table to filter on the "Dwg Name" field:

PnPTable tbl = db.Tables["PnPDrawings"];      const string where = ""Dwg Name"='PIP-01-102.dwg'";      PnPRow[] rows = tbl.Select(where);

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading