Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# computed numeric field
# counts the number of polygons attached to a record
# CLASS table has some records attached to more than one polygon
# assumes every value in CLASS.Class field is unique;
# Cindy Robbins 21 Oct 2014
numeric elemNum2, count, numP, totalP, i;
string uniqueClass$, thisClass$;
count = 0;
numP = 0;
totalP = NumVectorPolys(Vect); # number of polygons in the vector
uniqueClass$ = CLASS.Class; # get value for the current record, must be unique
# go through every polygon and if it has the same CLASS.Class value add it to the count
for i = 1 to totalP {
elemNum2 = Vect.poly.Internal[i].ElemNum;
thisClass$ = Vect.poly[elemNum2].CLASS.Class$; # '$' must be added to end of Class field to indicate it holds a string
if (thisClass$ == uniqueClass$) {
count = count + 1;
}
}
return count;