table_relate_func.sml

  Download

More scripts: Vector

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# Table write Attachemnet
clear();
# uses a copy of cbsoils
string infile$ = "c:/data/cb_data/cb_soils2.rvc";
Vector cbSoilsLite;
GetInputVector(cbSoilsLite);
func relateTable(class DBFIELDINFO pkey, class DBFIELDINFO fkey)
{
	pkey.IsPrimaryKey = 1;
	fkey.Key = pkey;
	pkey.IsIndexed = 1;
	fkey.IsIndexed = 1;
}
# table info
class DBTABLEINFO ClassTable;
class DBTABLEINFO MapunitTable;
ClassTable = TableGetInfo(cbSoilsLite.poly.CLASS);
MapunitTable = TableGetInfo(cbSoilsLite.poly.MAPUNIT);
# field info
class DBFIELDINFO ClassField;
class DBFIELDINFO musymField;
ClassField = FieldGetInfoByName(ClassTable, "Class");
musymField = FieldGetInfoByName(MapunitTable, "musym");
# setup fo the relation
relateTable(ClassField, musymField);