<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I set an attribute value to NULL for a feature? in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226270#M1134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/350380"&gt;Orest Halustchak&lt;/A&gt;‌, yes this can be done.&amp;nbsp;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".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;const&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;A href="http://doc.qt.io/qt-5/qvariant.html" style="color: #0079c1; text-decoration: none;"&gt;&lt;SPAN class=""&gt;QVariant&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;SPAN class="" style="color: #1c00cf;"&gt;jsonNull&lt;/SPAN&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;A href="http://doc.qt.io/qt-5/qjsonvalue.html" style="color: #0079c1; text-decoration: none;"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;QJsonValue&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;()&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;; // this is a "null" value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's explained here in more detail:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-attributelistmodel.html#details" title="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-attributelistmodel.html#details"&gt;AttributeListModel Class | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let us know if that works for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Mar 2019 22:50:02 GMT</pubDate>
    <dc:creator>JamesBallard1</dc:creator>
    <dc:date>2019-03-14T22:50:02Z</dc:date>
    <item>
      <title>How do I set an attribute value to NULL for a feature?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226269#M1133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;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.&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;I'm using C++ Qt Runtime sdk 100.3.&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;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.&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;What I'm doing is this:&lt;/P&gt;&lt;UL style="margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;" type="disc"&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;Create a new feature using ServiceFeatureTable::createFeature().&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;Create a QMap&amp;lt;QString, QVariant&amp;gt; of feature attributes.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;Create a null QVariant value: QVariant qv = QVariant();&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;I verified that qv.IsNull() is true;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;Add to the attributes list: featureAttributes.insert("MyAttrName", qv);&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;I used this for both string and int attributes.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;Create a new feature: featureTable-&amp;gt;createFeature(featureAttributes, geom, this);&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;If I go ahead and add that feature to the table and apply edits, then I see that the resulting attribute is not null but has a non-null empty string for string attributes and 0 for int attributes.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;What I also found was that if right after creating the feature, I get the attributes back via the AttributeListModel, the attributes are no longer null.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;AttributeListModel* alm = feature-&amp;gt;attributes();&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;QVariant qv2 = alm-&amp;gt;attributeValue(QString("MyAttrName"));&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;qDebug() &amp;lt;&amp;lt; "qv2 is null =" &amp;lt;&amp;lt; qv2.isNull();&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN style="font-family: Calibri; font-size: 11.0pt;"&gt;This returns false. I expected it to return true.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;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();&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;I need a way to set values to null explicitly.&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Does anyone have suggestions as to what to try? I am probably missed something.&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2019 18:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226269#M1133</guid>
      <dc:creator>OrestHalustchak</dc:creator>
      <dc:date>2019-03-13T18:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set an attribute value to NULL for a feature?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226270#M1134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/350380"&gt;Orest Halustchak&lt;/A&gt;‌, yes this can be done.&amp;nbsp;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".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;const&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;A href="http://doc.qt.io/qt-5/qvariant.html" style="color: #0079c1; text-decoration: none;"&gt;&lt;SPAN class=""&gt;QVariant&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt; &lt;SPAN class="" style="color: #1c00cf;"&gt;jsonNull&lt;/SPAN&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;A href="http://doc.qt.io/qt-5/qjsonvalue.html" style="color: #0079c1; text-decoration: none;"&gt;&lt;SPAN class=""&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;QJsonValue&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #595959;"&gt;&lt;SPAN class="" style="color: #5c2699;"&gt;()&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;; // this is a "null" value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's explained here in more detail:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-attributelistmodel.html#details" title="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-attributelistmodel.html#details"&gt;AttributeListModel Class | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let us know if that works for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2019 22:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226270#M1134</guid>
      <dc:creator>JamesBallard1</dc:creator>
      <dc:date>2019-03-14T22:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set an attribute value to NULL for a feature?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226271#M1135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was it. It worked.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Orest.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2019 13:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-do-i-set-an-attribute-value-to-null-for-a/m-p/226271#M1135</guid>
      <dc:creator>OrestHalustchak</dc:creator>
      <dc:date>2019-03-19T13:58:43Z</dc:date>
    </item>
  </channel>
</rss>

