TableSetField
Previous  Top  Next

Prototype

TableSetField(intTableHandle, intFieldNumber, strFieldValue)

Description

It sets the field value by using the field progressive number as indicator.

Parameters

IntTableHandle
: integer value corresponding to the table handle.

IntFieldNumber
: integer value corresponding to the field progressive number.

StrFieldValue
: new field value.

Returned value

None.

Notes

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

Example

//It opens a table
UnaTabella:=TableOpen('c:\invoices\index','invoices.db'); 

name:=TablegetFieldname(UnaTabella,1);

//It orders the table according to a field
TableSetIndex(UnaTabella, name); 



//It stores the index 1 field data
FieldValue:='Smith';

//It looks for data within the table and places itself on the record
TableFindNearest(UnaTabella,FieldValue);

//It stores the table field value into a variable 
FoundValue:=TableGetField(UnaTabella,1);

// If the table value is different than the field one then…
If FoundValue<>FieldValue Then
Begin

//It sets the table insert mode   
TableInsert(UnaTabella);  
 
//It stores the field value in a new record  
TableSetField(UnaTabella,1,FieldValue);  
 
//It confirms the table change   
TablePost(UnaTabella);  
End;

// It closes the table
TableClose(UnaTabella);