<?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: Getting an error  on selecting a column in data expression (Arcade) in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055975#M39960</link>
    <description>&lt;P&gt;There's maybe a much better way of doing it, but I just calculated the total null dates as a variable, the total not null dates as a variable (total count - count null), then created a new feature set containing those values.&lt;/P&gt;&lt;P&gt;I've added your time field as features.verwij...&amp;nbsp; (Line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; but I may have spelt it wrong, other than that the only thing you should add is the portal item ID (Line 2).&lt;/P&gt;&lt;P&gt;For the pie chart widget, In 'Data Options' I would probably choose 'Categories from - 'Fields' -&amp;gt; add both Total Null and TotalNotNull fields, and use a statistic of 'Sum'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('https://www.arcgis.com')
var features = FeatureSetByPortalItem(portal, 'InsertYourItemIDHere')

var featCount = Count(features)

var nullCount = 0
for (var feature in features) {
    if (IsEmpty(feature.VerwijderdOp)) {
        nullCount += 1
    };
}

var notNullCount = featCount - nullCount

var featureDict = {
    'fields': [{'name':'TotalNull', 'type':'esriFieldTypeDouble'},{'name':'TotalNotNull', 'type':'esriFieldTypeDouble'}
        ],
    'geometryType':'',
    'features':

[
  { 
    "attributes" : {
      "TotalNull" : nullCount,
      "TotalNotNull" : notNullCount,

    }
  },

]}
     
return FeatureSet(Text(featureDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 08 May 2021 13:04:11 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-05-08T13:04:11Z</dc:date>
    <item>
      <title>Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055802#M39948</link>
      <description>&lt;P&gt;So I have a dataset that contains a column with dates. I want to create a pie-chart that shows the amount of cells in that column that is empty and the amount that has a value. So I tried to create a data expression. In this data expression I filled in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;var feat=FeatureSetByPortalItem(Portal('correctaddress'), '6227a7a523744c978d8fb6280168c119', 0)&lt;BR /&gt;return IsEmpty(feat.VerwijderdOp)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Of course the 'correctaddress' is normally filled with the actual link to my organisation. If I just do return(feat) I can see the entire table, which has a column called VerwijderdOp. However, when I try this or even try to access any column, so even something as simple as return feat.OBJECTID, I get the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN class="text-red"&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN&gt;Runtime Error: Cannot call member property on object of this type. VerwijderdOp&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can anybody help me out?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 18:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055802#M39948</guid>
      <dc:creator>jonasvanduijvenbode</dc:creator>
      <dc:date>2021-05-07T18:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055839#M39949</link>
      <description>&lt;P&gt;I'd say IsEmpty() is a logical check against a field value, and you're attempting to input a feature set as an argument.&lt;/P&gt;&lt;P&gt;What do you actually want to do?&amp;nbsp; Can you not just return your feature set and then use that as the input for the pie chart (classified by Null / Not Null?).&lt;/P&gt;&lt;P&gt;Or use the Count and Filter methods together - described here -&amp;nbsp;&lt;A href="https://gis.stackexchange.com/questions/355050/calculating-feature-count-of-attribute-type-using-arcade-in-arcgis-online" target="_blank"&gt;Calculating feature count of attribute type using arcade in ArcGIS Online - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 19:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055839#M39949</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-07T19:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055854#M39950</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply. I am indeed trying to use a column in my feature set as an argument, so any help with that would be great.&lt;/P&gt;&lt;P&gt;Your solution (Null/Not Null) is not possible since the column that I want to use 'called verwijderdop' is a date column which you cannot use in a pie chart.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The link that you provided would work for pop-ups etc but not for what I am trying to do here.&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 20:14:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055854#M39950</guid>
      <dc:creator>jonasvanduijvenbode</dc:creator>
      <dc:date>2021-05-07T20:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055975#M39960</link>
      <description>&lt;P&gt;There's maybe a much better way of doing it, but I just calculated the total null dates as a variable, the total not null dates as a variable (total count - count null), then created a new feature set containing those values.&lt;/P&gt;&lt;P&gt;I've added your time field as features.verwij...&amp;nbsp; (Line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; but I may have spelt it wrong, other than that the only thing you should add is the portal item ID (Line 2).&lt;/P&gt;&lt;P&gt;For the pie chart widget, In 'Data Options' I would probably choose 'Categories from - 'Fields' -&amp;gt; add both Total Null and TotalNotNull fields, and use a statistic of 'Sum'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('https://www.arcgis.com')
var features = FeatureSetByPortalItem(portal, 'InsertYourItemIDHere')

var featCount = Count(features)

var nullCount = 0
for (var feature in features) {
    if (IsEmpty(feature.VerwijderdOp)) {
        nullCount += 1
    };
}

var notNullCount = featCount - nullCount

var featureDict = {
    'fields': [{'name':'TotalNull', 'type':'esriFieldTypeDouble'},{'name':'TotalNotNull', 'type':'esriFieldTypeDouble'}
        ],
    'geometryType':'',
    'features':

[
  { 
    "attributes" : {
      "TotalNull" : nullCount,
      "TotalNotNull" : notNullCount,

    }
  },

]}
     
return FeatureSet(Text(featureDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 13:04:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055975#M39960</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-08T13:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055983#M39961</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;very impressive, thank you so much for this answer! So also if I understand correctly I cannot apply a function on an array but I can apply it item-wise, which is naturally done in a pop-up but requires a for-loop in a data expression. This makes sense and again thank you for the solution.&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 16:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055983#M39961</guid>
      <dc:creator>jonasvanduijvenbode</dc:creator>
      <dc:date>2021-05-08T16:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055984#M39962</link>
      <description>&lt;P&gt;No problem.&amp;nbsp; My Javascript formatting is far from impressive though.&lt;/P&gt;&lt;P&gt;Not exactly, you can perform functions still on any objects which are valid arguments to those functions.&amp;nbsp; I think the issue is really that the Data Expression always has to return a FeatureSet otherwise it's invalid.&lt;/P&gt;&lt;P&gt;Using Data Expressions to store computed variables/objects I think would be handy and very useful in the future, I can only guess that having only a FeatureSet created at the moment makes it much easier to be an input to the existing dashboard elements.&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 16:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1055984#M39962</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-08T16:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an error  on selecting a column in data expression (Arcade)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1058294#M40074</link>
      <description>&lt;P&gt;I should add that I should have specified the specific columns without geometry to speed it up.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyportalitem" target="_blank"&gt;Data Functions | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;e.g. insert the additional parameters fieldList = ['Field1', Field2'...] and&amp;nbsp;&lt;SPAN&gt;includeGeometry = False&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 18:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-an-error-on-selecting-a-column-in-data/m-p/1058294#M40074</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-15T18:50:02Z</dc:date>
    </item>
  </channel>
</rss>

