Maptitude GISDK Help |
Initializes a new instance of the class to calculate fields in a data table. Inherits AddTables.
CalculateTables(array options)
Option |
Type |
Description |
ViewName |
string |
Use an already opened view |
ViewNames |
array |
An array of options of two already opened view names and join fields. Name: Name of the view Field: Name of the field for the join |
TableNames |
array |
An array of options of two table or layer files Name: Layer or table file name Field: Name of the field for the join |
|
|
|
AddFields (opt) |
Add output fields to the tables FieldSpecs: Array of arrays of fieldname, field type and optional width and decimals Table: Optional for joined tables. Right or left tables. Default is left |
Name |
Type |
Contents |
|
Filter |
string |
Optional. Name of the selection set filter |
|
GetView |
Returns the name of the view |
ApplyFilter( filter )
Filters the data for the calculations.
Option |
Type |
Description |
|
filter |
string |
Selection set query |
ClearFilter()
Removes current filter.
ClearOperations()
Clear all configured operations.
Option |
Type |
Description |
|
FormulaName |
string |
Name of the temporary dataview field containing the formula |
ClearOperations()
Clear all configured operations.
AddFormula(opts)
Create a temporary formula that can be used for the fill operation. It returns the formula name.
Option |
Type |
Description |
|
opts |
array |
||
FormulaName |
string |
Name of the temporary dataview field containing the formula |
|
Formula |
string |
Formula definition |
Operation(opt)
Definition of the fill operation.
Option |
Type |
Description |
|
opts |
array |
||
FieldName |
string |
Name of the output field name |
|
Formula |
string |
Fill operation formula definition |
Calculate()
Perform the fill operation
Statistics(opts)
Returns a summary statistics for the field.
Option |
Type |
Description |
|
opts |
array | ||
FieldName |
string |
Name of the output field name |
|
Method |
string |
Optional. Default value is 'Sum'. Same options as macro function VectorStatistic. |
|
Options |
array |
Optional. Same options as macro function VectorStatistic. |
macro "FillData"
on error, escape, notfound do
ErrorMsg = GetLastError({"Reference Info": true})
ShowMessage(ErrorMsg)
return()
end
folder = RunMacro("G30 Tutorial Folder")
LeftTable = folder + "ParcelInfo.Bin"
RightTable = folder + "BuildingFootprint.bin"
NewFields = {
{"LandToBldgRatio", "Real", 12, 2},
{"FYPerSqFt", "Real", 12, 2},
{"BuildingFloors", "int", 12, 2} ,
{"RandomValues", "Real",e 12, 2}
}
obj = CreateObject("CalculateTables", {
AddFields: { FieldSpecs: NewFields, Table: "Left"},
TableNames: { { Name: LeftTable, Field: "ID"}, {Name: RightTable, Field: "ParcelID"}}
})
obj.ApplyFilter("[Property Class] = \"Residential One Family\"" )
data =obj.ReadData({FieldNames: {"Floors"}})
obj.WriteData({ Data: {{"BuildingFloors", data.Floors}}, SortOrder: null })
//vecs2 =obj.ReadData({FieldNames: {"HBW_P", "HBNW_P"}, SortOrder: null})
//obj.WriteData({ Data: {{"Other", vecs.HBW_P * 3}, {"Health", vecs2.HBNW_P}}, SortOrder: null })
obj.Operation({FieldName: "LandToBldgRatio", Formula: "[Lot Size] * [Building Size]"})
obj.Operation({FieldName: "FYPerSqFt", Formula: "FY99Bld /[Building Size] "})
obj.Operation({FieldName: "RandomValues", Formula: "RandomNumber() * 10000"})
obj.Calculate()
return(true)
endmacro
See Also:
©2025 Caliper Corporation | www.caliper.com |