home products news downloads documentation support gallery online maps resellers search
TNTmips Downloads Menu

HOME

CONTACT US

CURRENT RELEASE
  TNT 2013

DEVELOPMENT VERSION
  TNT 2014

TNTmips Pro
PRIOR RELEASES
  TNT 2012

FREE SOFTWARE
  TNTmips Free
  TNTatlas
  TNTsdk

MORE DOWNLOADS
  HASP Key Driver
  Screen Recorder
  TNT Language Kits
  Sample Geodata
  TNT Scripts

DOCUMENTATION
  TNTmips Tutorials
  Tutorial Datasets
  Technical Guides
  Scripts
  Quick Guides

MORE INFO
  Download FAQs
  FTP
  Download Managers
  Find Reseller

SITE MAP


create.sml


##################################################################
#
#	Sample SML Script which shows how to create a database table
#	and set it to be related to another table
#
#
vector Vect;
class DATABASE db;
class DBTABLEINFO tinfo;
class DBFIELDINFO finfo, keyfinfo;

string tablename$ = "SML1";			# This is the name we'll use for the table
string fieldname$ = "field";		# This is the name we'll use for the field

GetInputVector(Vect);

#----------------------------------------------------------
# Get the handle for the polygon database

db = OpenVectorPolyDatabase(Vect);

#----------------------------------------------------------
# Create a table named SML1

TableCreate(db, tablename$, "Created from SML");

#----------------------------------------------------------
# Get the info for this table.

tinfo = TableGetInfo(Vect.poly.(tablename$));

#----------------------------------------------------------
# Make the table Related Only

tinfo.RelatedOnly = 1;

#----------------------------------------------------------
# Add a 40 character wide string field.
#	Note that Vect.poly.(tablename$) is the same as sayig
#	Vect.poly.SML1 but lets us use a variable to select the

TableAddFieldString(Vect.poly.(tablename$), fieldname$, 40);

#----------------------------------------------------------
# Get the field infos of the Primary key and the field we 
# just created

finfo = FieldGetInfoByName(Vect.poly.(tablename$), fieldname$);
keyfinfo = FieldGetInfoByName(Vect.poly.CLASS, "Class");

#----------------------------------------------------------
# Make the field we just created a point to the primary key

finfo.Key = keyfinfo;



Back Home ©MicroImages, Inc. 2013 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010   USA
Business & Sales: (402)477-9554  Support: (402)477-9562  Fax: (402)477-9559
Business info@microimages.com  Support support@microimages.com  Web webmaster@microimages.com

25 March 2009

page update: 26 May 11