I have three data loggers and my java application is fetching data from all them periodically. Having the table name I can easily pull the values from that table, however what I want to do is first obtain the list of available tables and tables' field for each of my data loggers and then grab the values. My question is how I can obtain the list of all tables and then for any specific table how to obtain the table's field (columns names)?
The class TableDef holds the meta-data for one table on a Campbell Scientific datalogger, however I do not see any method that performs what I want.
The Datalogger class in the SDK has two methods that will probably be of interest to you:
- get_tables_count(): Returns the number of tables that are currently known
- get_table(int table_no): Returns the table associated with the specified zero-based index.
Hi
This is not what I need. As I mentioned in my question, I need the table's field (columns name). I need something like "get_column_name()" in the "ValueName" class. I think all tables' field must be available in the tables definition when we use GetTableDefsTran transaction, however I can not find a way to access them.
Class TableDef has a public member, columns, which is a vector of ColumnDef objects. Each ColumnDef object has the means to describe one or more array members that this object represents. You can use the ColumnDef.get_values_count() method to obtain the number of fields represented by a column and can then use the ColumnDef.format_name() method in order to create a string that uniquely identifies each field represented by a ColumnDef object.
Thanks for your help. I finally got it, however It seems that the columns TimeStamp and RecordNumber are not part of the table field. Am I correct?
Timestamp and record number are metaproperties associated with the record and are not a part of the table definition.