Maptitude GISDK Help

Writing Data to a View

The following syntax is used to update the value of a field in a view:

 

view_name.field_name = x

 

This syntax updates the value of field_name for the current record in view_name. If there is no current record, execution of this statement causes an error.

 

Here is sample code that updates the Population and capital of New York State:

 

// Find New York State

view = "States"

rec = FindRecord(view + "|", "Name", {"New York"}, null)

 

// Change the Population and Capital City

view.Population = 1234567

view.Capital = "Yonkers"

 

Here is a sample macro that loops over States in order of descending population, and fills in the field called Rank with the population ranking:

 

// First, create the view

view = OpenTable("State Data", "DBASE", "c:\\dbf\\states.dbf", ) + "|"

counter = 0

 

// Set the order in which to loop over the file

order = {{"Population", "Descending"}}

 

// Start the loop...

rec = GetFirstRecord(view, order)

while rec <> null do

     // increment the counter

     counter = counter + 1

 

     // fill in the ranking

     view.Rank = counter

 

     // Here are alternate ways to do the same thing

     // rank_str = "Rank"

     // view_list = {"A", "B", view}

     // view.(rank_str) = counter

     // view_list[3].Rank = counter

     // view_list[3].(rank_str) = counter

 

     // Go on to the next state

     rec = GetNextRecord(view, null, order)

     end

 

In addition to the above syntax, the following GISDK function can be used to write data to a view:

 

GISDK Function

Summary

SetEditorValues()

Writes a value or sequence of numbers into a range of cells in an editor window

SetRecordValues()

Updates the data for a record in a view

SetRecordsValues()

Writes a value or sequence of numbers into a range of cells in a view on a table

 

 

©2025 Caliper Corporation www.caliper.com