More scripts: Vector
Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# Cindy Robbins, 17Feb2003
# simple script to show how to navigate through all of the tables and fields in the polgyon database for a vector
# you can use any vector with polygons as input (such as cbsoils_lite)
VECTOR V;
numeric check1, check2, tableCount, fieldCount, polyCount;
class DBTABLEINFO tableInfo;
class DBFIELDINFO fieldInfo;
class DATABASE db;
GetInputVector(V);
polyCount = V.$Info.NumPolys;
db = OpenVectorPolyDatabase(V);
clear(); # clear console window
print("There are ", polyCount, " polygons and the following ", db.NumTables, " tables ");
print("in the ", V.$Info.Name, " vector object:");
# Go through all of the tables in the selected vector
tableCount = db.NumTables ;
check1 = 0;
while (check1 < tableCount) {
tableInfo = DatabaseGetTableInfo(db,check1);
print(" The ", tableInfo.Name, " table has ", tableInfo.NumRecords, " record(s) and the following ", tableInfo.NumFields, " field(s).");
# Go through all of the fields in the 'check1' table
fieldCount = tableInfo.NumFields;
check2 = 0;
while (check2 < fieldCount) {
check2 = check2 + 1;
fieldInfo = FieldGetInfoByNumber(tableInfo, check2);
print (" ", fieldInfo.Name);
}
check1 = check1 + 1;
}