An appropriate list of values for a Field. More...
Header: | #include <CodedValueDomain.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | Esri::ArcGISRuntime::Domain |
Public Functions
CodedValueDomain() | |
CodedValueDomain(const Esri::ArcGISRuntime::CodedValueDomain &other) | |
CodedValueDomain(Esri::ArcGISRuntime::CodedValueDomain &&other) | |
CodedValueDomain(const Esri::ArcGISRuntime::Domain &other) | |
virtual | ~CodedValueDomain() override |
QList<Esri::ArcGISRuntime::CodedValue> | codedValues() const |
bool | isValid() const |
Esri::ArcGISRuntime::CodedValueDomain & | operator=(const Esri::ArcGISRuntime::CodedValueDomain &other) |
Esri::ArcGISRuntime::CodedValueDomain & | operator=(Esri::ArcGISRuntime::CodedValueDomain &&other) |
Detailed Description
A coded value domain consists of a collection of coded values that are saved in the dataset. When a user is editing data, you can present the list of coded values for the fields (attributes) they edit, or validate their input values against the coded value domain before changes are saved. This ensures that the user maintains data integrity by only applying values that are in the codedValues.
You can create a coded value domain in a mobile geodatabase, if the mobile geodatabase was created in ArcGIS Pro or using Geodatabase::createAsync(const QString&, QObject*). To create a CodedValueDomain, you can create a CodedValueDomainDescription that has a collection of CodedValueDescription, by using CodedValueDomainDescription::CodedValueDomainDescription(const QString&, Esri::ArcGISRuntime::FieldType, const QList<Esri::ArcGISRuntime::CodedValueDescription*>&, QObject*). Next, you create the CodedValueDomain by calling Geodatabase::createDomainAsync(Esri::ArcGISRuntime::DomainDescription*) with the CodedValueDomainDescription.
Example:
Obtain coded values from a field's CodedValueDomain:
// Create service feature table auto* featureTable = new ServiceFeatureTable(serviceUrl1, this); // Connect to loadStatusChanged signal to access fields once loaded connect(featureTable, &ServiceFeatureTable::loadStatusChanged, [featureTable](LoadStatus loadStatus) { if (loadStatus == LoadStatus::Loaded) { Field field = featureTable->field("PRIMCAUSE"); CodedValueDomain codedValueDomain = static_cast<CodedValueDomain>(field.domain()); QString codedValue1 = codedValueDomain.codedValues().at(0).name(); QString codedValue2 = codedValueDomain.codedValues().at(1).name(); QString codedValue3 = codedValueDomain.codedValues().at(2).name(); QString codedValue4 = codedValueDomain.codedValues().at(3).name(); } });
Relevant samples:
- Add features with contingent values: Create and add features whose attribute values satisfy a predefined set of contingencies.
- Configure subnetwork trace: Get a server-defined trace configuration for a given tier and modify its traversability scope, add new condition barriers and control what is included in the subnetwork trace result.
- Validate utility network topology: Demonstrates the workflow of getting the network state and validating the topology of a utility network.
See also CodedValue.
Member Function Documentation
CodedValueDomain::CodedValueDomain ()
Default constructor. Creates an empty and invalid CodedValueDomain with domainType DomainType::Unknown
.
See also DomainType.
CodedValueDomain::CodedValueDomain (const Esri::ArcGISRuntime::CodedValueDomain &other)
Copy constructor from other CodedValueDomain.
CodedValueDomain::CodedValueDomain (Esri::ArcGISRuntime::CodedValueDomain &&other)
Move constructor from other CodedValueDomain.
[explicit]
CodedValueDomain::CodedValueDomain (const Esri::ArcGISRuntime::Domain &other)
Converting constructor from other Domain.
See also Downcast helper functions.
[override virtual]
CodedValueDomain::~CodedValueDomain ()
Destructor.
QList<Esri::ArcGISRuntime::CodedValue > CodedValueDomain::codedValues () const
Returns the collection of coded values of this domain.
Each valid value is assigned a unique name.
[since Esri::ArcGISRuntime 100.2]
bool CodedValueDomain::isValid () const
Gets whether this CodedValueDomain is valid.
A CodedValueDomain is valid if it is not empty and domainType is DomainType::CodedValueDomain.
Returns true
if valid.
This function was introduced in Esri::ArcGISRuntime 100.2.
Esri::ArcGISRuntime::CodedValueDomain &CodedValueDomain::operator=(const Esri::ArcGISRuntime::CodedValueDomain &other)
Assignment operator from other CodedValueDomain.
Esri::ArcGISRuntime::CodedValueDomain &CodedValueDomain::operator=(Esri::ArcGISRuntime::CodedValueDomain &&other)
Move operator from other CodedValueDomain.