Skip To Content ArcGIS for Developers Sign In Dashboard

Field Class

(Esri::ArcGISRuntime::Field)

Information about a field from a feature table. More...

Header: #include <Field>
Since: Esri::ArcGISRuntime 100.0

Public Functions

Field()
Field(FieldType fieldType, const QString &name, const QString &alias, int length, const Domain &domain, bool isEditable, bool isNullable)
Field(const Field &other)
Field(Field &&other)
~Field()
QString alias() const
Domain domain() const
FieldType fieldType() const
bool isEditable() const
bool isEmpty() const
bool isNullable() const
int length() const
QString name() const
QString toJson() const
Field &operator=(const Field &other)
Field &operator=(Field &&other)

Static Public Members

Field createDate(const QString &name, const QString &alias)
Field createDouble(const QString &name, const QString &alias)
Field createFloat(const QString &name, const QString &alias)
Field createLongInt(const QString &name, const QString &alias)
Field createShortInt(const QString &name, const QString &alias)
Field createText(const QString &name, const QString &alias, int length)
Field fromJSON(const QString &json)

Detailed Description

Information about a field from a feature table.

Example:

Create a ServiceFeatureTable and obtain one of its fields:

// Create service feature table
ServiceFeatureTable* serviceFeatureTable = new ServiceFeatureTable(serviceUrl, this);

// Connect to loadStatusChanged signal to access fields once loaded
connect(serviceFeatureTable, &ServiceFeatureTable::loadStatusChanged, [serviceFeatureTable](LoadStatus loadStatus)
{
    if (loadStatus == LoadStatus::Loaded)
    {
        Field field = serviceFeatureTable->field("PRIMCAUSE");
        QString fieldName = field.name();
        QString fieldAlias = field.alias();
    }
});

Member Function Documentation

Field::Field()

Default constructor. Creates an empty Field.

Field::Field(FieldType fieldType, const QString &name, const QString &alias, int length, const Domain &domain, bool isEditable, bool isNullable)

Create Field based on given parameters.

  • fieldType - The type of value in the field.
  • name - The name of the field.
  • alias - The alias name of the field.
  • length - The field length.
  • domain - The domain that limits valid field values to a range or to a set of coded values.
  • isEditable - Whether the field is editable.
  • isNullable - Whether the field can accept null values.

Field::Field(const Field &other)

Copy constructor from other Field.

Field::Field(Field &&other)

Move constructor from other Field.

Field::~Field()

Destructor.

QString Field::alias() const

Returns the alias name of the field.

The alias name is usually more user-friendly than the actual field name, which may be constrained by the underlying data source's naming convention.

If there is no alias defined, an empty string is returned.

[static] Field Field::createDate(const QString &name, const QString &alias)

Returns a field representing a date with the provided name and alias.

The field returned is editable and nullable.

[static] Field Field::createDouble(const QString &name, const QString &alias)

Returns a field representing a double with the provided name and alias.

The field returned is editable and nullable.

[static] Field Field::createFloat(const QString &name, const QString &alias)

Returns a field representing a float with the provided name and alias.

The field returned is editable and nullable.

[static] Field Field::createLongInt(const QString &name, const QString &alias)

Returns a field representing a 32 bit int with the provided name and alias.

The field returned is editable and nullable.

[static] Field Field::createShortInt(const QString &name, const QString &alias)

Returns a field representing a 16 bit int with the provided name and alias.

The field returned is editable and nullable.

[static] Field Field::createText(const QString &name, const QString &alias, int length)

Returns a field representing a string with the provided name, alias, and length.

The field returned is editable and nullable.

Domain Field::domain() const

Returns the domain that limits valid field values to a range or to a set of coded values.

If no domain is assigned to this field, then an empty Domain is returned.

FieldType Field::fieldType() const

Returns the type of value in the field.

[static] Field Field::fromJSON(const QString &json)

Creates a new Field from an ArcGIS JSON representation.

  • json - The JSON text.

bool Field::isEditable() const

Returns whether the field is editable.

bool Field::isEmpty() const

Returns true if this Field is empty.

bool Field::isNullable() const

Returns whether the field can accept null values.

int Field::length() const

Returns the field length.

QString Field::name() const

Returns the name of the field.

QString Field::toJson() const

Returns the ArcGIS json representation of the field.

Field &Field::operator=(const Field &other)

Assignment operator from other Field.

Field &Field::operator=(Field &&other)

Move operator from other Field.


Feedback on this topic?