User Tools

Site Tools


api:dk11:activex:tatukgis_xdk11.itgis_layervector.addfield_widestring_tgis_fieldtype_integer_integer

Table of Contents

ITGIS_LayerVector.AddField method

DK11 for ActiveX | TatukGIS_XDK11.ITGIS_LayerVector.AddField | Methods | Properties

Adds a new field.

Available also on: Delphi | .NET | Java.

Syntax

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

Parameters

Name Type Description
_name WideString 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

2020/05/28 09:04