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


cumul.sml


clear();  #clear console

vector Vect;
class DATABASE database;
class DBTABLEINFO tableinfo;
class DBTABLEINFO populationinfo;
numeric numPoints;
numeric index;
numeric record;
numeric numRecords;
numeric value;
numeric population;
array numeric records[1];

GetInputVector(Vect);

database = OpenVectorPointDatabase(Vect);

# Create new table

populationinfo = TableCreate(database,"Population","Created by SML script");
TableAddFieldInteger(populationinfo,"population",12);
TableAddFieldString(populationinfo,"people",16,16);

# Open old table

tableinfo = DatabaseGetTableInfo(database,"TABLE");

numPoints = NumVectorPoints(Vect);

numeric i;
for i=1 to numPoints {
	numRecords = TableReadAttachment(tableinfo,i,records,"point");
	if (numRecords <= 0) continue;
	record = records[1];

	# Write White Non Hispanic population
	value = TableReadFieldNum(tableinfo,"WhiteNonH",record);
	population = value;
	index = TableNewRecord(populationinfo,population,"WhiteNonH");
	records[1] = index;
	TableWriteAttachment(populationinfo,i,records,1);

	# Write Asian population
	value = TableReadFieldNum(tableinfo,"ASIANPOP",record);
	population += value;
	index = TableNewRecord(populationinfo,population,"Asian");
	records[1] = index;
	TableWriteAttachment(populationinfo,i,records,1);

	# Write Black population
	value = TableReadFieldNum(tableinfo,"BLKPOP",record);
	population += value;
	index = TableNewRecord(populationinfo,population,"Black");
	records[1] = index;
	TableWriteAttachment(populationinfo,i,records,1);

	# Write Hispanic population
	value = TableReadFieldNum(tableinfo,"HISPPOP",record);
	population += value;
	index = TableNewRecord(populationinfo,population,"Hispanic");
	records[1] = index;
	TableWriteAttachment(populationinfo,i,records,1);


	}


printf("Script Ran to Completion");



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