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 createBigInt(const QString &name, const QString &alias)
    Esri::ArcGISRuntime::Field createDate(const QString &name, const QString &alias)
    Esri::ArcGISRuntime::Field createDateOnly(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 createTimeOnly(const QString &name, const QString &alias)
    Esri::ArcGISRuntime::Field createTimestampOffset(const QString &name, const QString &alias)
    Esri::ArcGISRuntime::Field fromJson(const QString &json)

    Detailed Description

    Example:

    Create a ServiceFeatureTable and obtain one of its fields:

    // Create service feature table
    auto* 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();
        }
    });

    Relevant samples:

    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, since Esri::ArcGISRuntime 200.4] Esri::ArcGISRuntime::Field Field::createBigInt(const QString &name, const QString &alias)

    Returns a new FieldType::Int64 field object with the following parameters.

    • name - Name of the field.
    • alias - Alias of the field.

    Use this method to create a field. The field will be editable and nullable.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    [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, since Esri::ArcGISRuntime 200.4] Esri::ArcGISRuntime::Field Field::createDateOnly(const QString &name, const QString &alias)

    Returns a new FieldType::DateOnly field object with the following parameters.

    • name - Name of the field.
    • alias - Alias of the field.

    Use this method to create a field. The field will be editable and nullable.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    [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.

    [static, since Esri::ArcGISRuntime 200.4] Esri::ArcGISRuntime::Field Field::createTimeOnly(const QString &name, const QString &alias)

    Returns a new FieldType::TimeOnly field object with the following parameters.

    • name - Name of the field.
    • alias - Alias of the field.

    Use this method to create a field. The field will be editable and nullable.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    [static, since Esri::ArcGISRuntime 200.4] Esri::ArcGISRuntime::Field Field::createTimestampOffset(const QString &name, const QString &alias)

    Returns a new FieldType::TimestampOffset field object with the following parameters.

    • name - Name of the field.
    • alias - Alias of the field.

    Use this method to create a field. The field will be editable and nullable.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    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, since Esri::ArcGISRuntime 200.4] Esri::ArcGISRuntime::Field Field::fromJson(const QString &json)

    Creates a new Field from an ArcGIS JSON representation.

    • json - The JSON text.

    This function was introduced in Esri::ArcGISRuntime 200.4.

    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.