<?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 Dictionary type Expected in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045607#M39524</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I was wondering why this would give me a "Dictionary type expected" error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var grid = featuresetbyname($datastore, 'Grid', ['GridNo'], false);
Console("cnt gird: " + Count(grid));
var grid_intersects = intersects($feature,grid);

var cnt = count(grid_intersects);
Console("cnt gird_name: " + Count(grid_intersects));
console("prefix: " + First(grid_intersects.GridNo))

if (cnt &amp;gt; 0) {
    
    var prefix = First(grid_intersects.GridNo)

    return Concatenate(prefix, NextSequenceValue("SVWD_FacilityID"))
}
else {
    return 'error'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this expression works and returns the values I expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var grid = featuresetbyname($datastore, 'Grid', ['GridNo'], false);
Console("cnt gird: " + Count(grid));
var grid_intersects = intersects($feature,grid);

for(var s in grid_intersects){
return Concatenate(s.GridNo,NextSequenceValue("SVWD_FacilityID"))
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that a for loop will loop over a dictionary (or I assume it will), but in my first statement I am only getting 1 result, why cant I just use a if statement? I noticed a few other posts like this one but no one explains why this error even occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Apr 2021 22:05:26 GMT</pubDate>
    <dc:creator>JimWilliams</dc:creator>
    <dc:date>2021-04-09T22:05:26Z</dc:date>
    <item>
      <title>Dictionary type Expected</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045607#M39524</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I was wondering why this would give me a "Dictionary type expected" error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var grid = featuresetbyname($datastore, 'Grid', ['GridNo'], false);
Console("cnt gird: " + Count(grid));
var grid_intersects = intersects($feature,grid);

var cnt = count(grid_intersects);
Console("cnt gird_name: " + Count(grid_intersects));
console("prefix: " + First(grid_intersects.GridNo))

if (cnt &amp;gt; 0) {
    
    var prefix = First(grid_intersects.GridNo)

    return Concatenate(prefix, NextSequenceValue("SVWD_FacilityID"))
}
else {
    return 'error'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this expression works and returns the values I expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var grid = featuresetbyname($datastore, 'Grid', ['GridNo'], false);
Console("cnt gird: " + Count(grid));
var grid_intersects = intersects($feature,grid);

for(var s in grid_intersects){
return Concatenate(s.GridNo,NextSequenceValue("SVWD_FacilityID"))
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that a for loop will loop over a dictionary (or I assume it will), but in my first statement I am only getting 1 result, why cant I just use a if statement? I noticed a few other posts like this one but no one explains why this error even occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 22:05:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045607#M39524</guid>
      <dc:creator>JimWilliams</dc:creator>
      <dc:date>2021-04-09T22:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary type Expected</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045614#M39525</link>
      <description>&lt;P&gt;It's likely the way you're using &lt;STRONG&gt;Concatenate&lt;/STRONG&gt;. Rather than concatenating all the arguments (as in Excel or similar), the first argument should be all the items to be concatenated. The second should be the string to separate the items with.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Concatenate([prefix, NextSequenceValue("SVWD_FacilityID")], ' ')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, that isn't a &lt;EM&gt;dictionary&lt;/EM&gt;. That seems odd.&lt;/P&gt;&lt;P&gt;Also, it looks like there's another error here:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;First(grid_intersects.GridNo)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;grid_intersects&lt;/STRONG&gt; is a &lt;EM&gt;FeatureSet&lt;/EM&gt;, and has no &lt;STRONG&gt;GridNo&lt;/STRONG&gt; property. To access the property, you need to shift the parenthesis.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;First(grid_intersects).GridNo&lt;/LI-CODE&gt;&lt;P&gt;There, we're accessing the &lt;STRONG&gt;GridNo&lt;/STRONG&gt; property of the &lt;EM&gt;Feature&lt;/EM&gt; returned by &lt;STRONG&gt;First&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Perhaps the combination of things is causing the dictionary error to pop up, though I can't be sure.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 22:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045614#M39525</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-09T22:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary type Expected</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045622#M39526</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;Bataboom batabing that was the issue,&lt;/P&gt;&lt;P&gt;Your answer was spot on. Do you think what is happening is feature sets are actually a dictionary. So the&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;First(grid_intersects.GridNo)&lt;/LI-CODE&gt;&lt;P&gt;issue might have been throwing that dictionary error?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 22:35:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045622#M39526</guid>
      <dc:creator>JimWilliams</dc:creator>
      <dc:date>2021-04-09T22:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary type Expected</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045638#M39530</link>
      <description>&lt;P&gt;Ah! That's probably it.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 23:52:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/dictionary-type-expected/m-p/1045638#M39530</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-09T23:52:59Z</dc:date>
    </item>
  </channel>
</rss>

