Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

Table Classes

  • Last UpdatedJun 06, 2022
  • 2 minute read

There are C# classes that enable direct access to the Dabacon tables. The classes are defined as follows:

NameTable - for iterating through name tables

RefTable - for iterating through reference tables

IntTable - for iterating through integer tables

These classes work on a single DB. In most cases, we really want to iterate through all DBs in the MDB as if it was one table. Thus for integer and name tables there are iterator classes that go across the whole MDB as follows:

MdbNameTable - for iterating through a name table across entire MDB

MdbIntTable - for iterating through an integer table across entire MDB

There is no method for iterating through a reference table since the order of references in a table is not meaningful.

There are also methods to return all entries for a given key. This is particularly useful for reference tables; these are methods of the MDB class.

In C# there is a NameTable class. An example of C# code that looks for all names starting with the letter 'B' is as follows:

string nam1=new string("/B");

string nam2=new string("/C");

NameTable ntable = new MdbNameTable(db, DBAttribute.NAME, nam1, nam2);

using (ntable)

{

foreach (Element ele in ntable)

{

// Do something here with each element

}

}

Freeing search tokens

Dabacon allocates search tokens when scanning tables. It has a limited number of search tokens. If you get to the end of the table then the token is freed automatically. However if you stop the search before you get to the end then you must explicitly free the token.

The IDispose method is used to free the underlying Dabacon token. Therefore ALWAYS scan the Dabacon table within a 'using' block to make sure that the Dispose method is called. If the underlying token is not freed then errors will be output to the AVEVA module command line of the form:

"xx dabacon search tokens - Expected none "

The error generating code does not actually free the tokens. So typically you will see the number climb as more tokens are used up and not freed. The messages will be generated until the database is closed.

Related Links
TitleResults for “How to create a CRG?”Also Available in