User Tools

Site Tools


api:dk11:net:tatukgis.ndk.tgis_layervector.addfield_string_tgis_fieldtype_integer_integer

Table of Contents

TGIS_LayerVector.AddField method

DK11 for .NET | TatukGIS.NDK.TGIS_LayerVector.AddField | Constructors | Fields | Methods | Properties | Events

Add a new field.

Available also on: Delphi | Java | ActiveX.

Syntax

// C#
public void AddField(
  string _name,
  TGIS_FieldType _type,
  int _width,
  int _decimal
);
' VisualBasic
Public Sub AddField(
  ByVal _name As String,
  ByVal _type As TGIS_FieldType,
  ByVal _width As Integer,
  ByVal _decimal As Integer
)
// Oxygene
public
  procedure AddField(
    _name : String;
    _type : TGIS_FieldType;
    _width : Integer;
    _decimal : Integer
  ); virtual;

Parameters

Name Type Description
_name string
String
name of field to be added
_type TGIS_FieldType type of field
_width int
Integer
width of field; not important for fields other then TGIS_FieldType.Number or TGIS_FieldType.String;
_decimal int
Integer
decimal places; not important for fields other then TGIS_FieldType.Number;

Remarks

Use this method to add a new field that will be marked as added and the final restructure will be performed on save. Unadd can be performed by RevertAll.

For TGIS_FieldType.String a _width will be treated as a hint. Value can represent any length but will be truncated on saving to the length defined in a current layer type. For example in TGIS_LayerSHP it will be truncated to 254 characters; in TGIS_LayerSQL will be truncated to the length defined in a database (defined on creation).

For TGIS_FieldType.Number a _width and a _decimal will be treated as a hint. Value can represent any float but will be truncated on save to the length limited in a current layer type. For example in TGIS_LayerSHP it will be truncated to exact _width & _precision value; in TGIS_LayerSQL will be stored as a float or Integer field (if _decimal = 0).

References

2018/10/26 18:11