TableSetField

Top  Previous  Next

Prototype

 

TableSetField(intTableHandle, intFieldNumber, strFieldValue)

 

Description

 

Sets the field value by using the field position number as the indicator.

 

Parameters

 

IntTableHandle: integer value corresponding to the table handle.

 

IntFieldNumber: integer value corresponding to the field position number.

 

StrFieldValue: new field value.

 

Returned value

 

None.

 

Notes

 

If the new field value is not String type, convert it by using the functions such as IntToStr, FloatToStr,…

 

Example

 

// Opens a table

TableOne:=TableOpenBDE('c:\invoices\index','invoices.db'); 

 

name:=TablegetFieldname(TableOne,1);

 

// Order the table according to a field

TableSetIndex(TableOne, name); 

 

// Store the index 1 field data

FieldValue:='Smith';

 

// Search for data within the table and places itself on the record

TableFindNearest(TableOne,FieldValue);

 

// Store the table field value into a variable

FoundValue:=TableGetField(TableOne,1);

 

// If the table value is different than the field one then…

If FoundValue<>FieldValue Then

Begin

 

// Set the table insert mode

TableInsert(TableOne);

 

// Store the field value in a new record

TableSetField(TableOne,1,FieldValue);

 

// Confirm the table change

TablePost(TableOne);

End;

 

// Close the table

TableClose(TableOne);