I'm having an issue when I try to set an attribute value to null in the process of adding a new feature to a feature table.
I'm using C++ Qt Runtime sdk 100.3.
I have a feature layer that is enabled for editing. The feature table has string and int attributes that are defined as Editable = yes and Allows Null Values = yes.
What I'm doing is this:
If I leave out the attributes from the attribute list altogether, then I do get null values in the resulting feature in the table. However, that approach will not work if the attributes include default values that will set them to non-null values and that approach will not work for ServiceFeatureTable::updateFeature();
I need a way to set values to null explicitly.
Does anyone have suggestions as to what to try? I am probably missed something.
Regards.
Solved! Go to Solution.
Orest Halustchak, yes this can be done. We make a distinction between invalid QVariant, for example if someone requested the value for a field that doesn't exist and legal, valid "null" values for fields whose value is actually "null".
const QVariant jsonNull(QJsonValue()); // this is a "null" value.
It's explained here in more detail: AttributeListModel Class | ArcGIS for Developers
Please let us know if that works for you.
Orest Halustchak, yes this can be done. We make a distinction between invalid QVariant, for example if someone requested the value for a field that doesn't exist and legal, valid "null" values for fields whose value is actually "null".
const QVariant jsonNull(QJsonValue()); // this is a "null" value.
It's explained here in more detail: AttributeListModel Class | ArcGIS for Developers
Please let us know if that works for you.
That was it. It worked.
Thanks!
Orest.