Field Class

  • Field
  • class Esri::ArcGISRuntime::Field

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

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

    Public Functions

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

    Static Public Members

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

    Detailed Description

    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(Esri::ArcGISRuntime::FieldType fieldType, const QString &name, const QString &alias, int length, const Esri::ArcGISRuntime::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 Esri::ArcGISRuntime::Field &other)

    Copy constructor from other Field.

    Field::Field(Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::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.

    Esri::ArcGISRuntime::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.

    Esri::ArcGISRuntime::FieldType Field::fieldType() const

    Returns the type of value in the field.

    [static] Esri::ArcGISRuntime::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.

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

    Assignment operator from other Field.

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

    Move operator from other Field.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.