<?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: Minor issue with arcade script that I typically don't run into. in ArcGIS Arcade Questions</title>
    <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596641#M32</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/501127"&gt;@VictorGutzler&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The second line populates an array of field names using the field name dictionary and the value populates a dictionary which is later added to an array as values.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 16:35:20 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2025-03-18T16:35:20Z</dc:date>
    <item>
      <title>Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596029#M24</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I typically don't have issues with arcade expressions but for some reason this one is returning the error message: "Unable to execute arcade script for Feature ObjectedID 0"&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetPctColor(P){
    var Color = When(
        P &amp;gt;= 0 &amp;amp;&amp;amp; P &amp;lt; 5,'#d01111',
        P &amp;gt;= 5 &amp;amp;&amp;amp; P &amp;lt; 10,'#cc2211',
        P &amp;gt;= 10 &amp;amp;&amp;amp; P &amp;lt; 15,'#c83311',
        P &amp;gt;= 15 &amp;amp;&amp;amp; P &amp;lt; 20,'#c34211',
        P &amp;gt;= 20 &amp;amp;&amp;amp; P &amp;lt; 25,'#bf5112',
        P &amp;gt;= 25 &amp;amp;&amp;amp; P &amp;lt; 30,'#bb5f12',
        P &amp;gt;= 30 &amp;amp;&amp;amp; P &amp;lt; 35,'#b76c12',
        P &amp;gt;= 35 &amp;amp;&amp;amp; P &amp;lt; 40,'#b37912',
        P &amp;gt;= 40 &amp;amp;&amp;amp; P &amp;lt; 45,'#af8512',
        P &amp;gt;= 45 &amp;amp;&amp;amp; P &amp;lt; 50,'#ab9012',
        P &amp;gt;= 50 &amp;amp;&amp;amp; P &amp;lt; 55,'#a79a12',
        P &amp;gt;= 55 &amp;amp;&amp;amp; P &amp;lt; 60,'#a2a312',
        P &amp;gt;= 60 &amp;amp;&amp;amp; P &amp;lt; 65,'#919f12',
        P &amp;gt;= 65 &amp;amp;&amp;amp; P &amp;lt; 70,'#819b12',
        P &amp;gt;= 70 &amp;amp;&amp;amp; P &amp;lt; 75,'#719712',
        P &amp;gt;= 75 &amp;amp;&amp;amp; P &amp;lt; 80,'#639312',
        P &amp;gt;= 80 &amp;amp;&amp;amp; P &amp;lt; 85,'#558f11',
        P &amp;gt;= 85 &amp;amp;&amp;amp; P &amp;lt; 90,'#478b11',
        P &amp;gt;= 90 &amp;amp;&amp;amp; P &amp;lt; 95,'#3b8711',
        '#2f8311'
        )
    return Color
    }
var fields = []
var Values = {}
for( var i=5; i&amp;lt;= 95; i=i+5 ){
    if( i%5 == 0 ){
        var f = {'name':'n'+Text(i), 'type':'esriFieldTypeSmallInteger'}
        Push( fields , f )
        Values[ 'n'+Text(i) ] = i
        f = {'name':'c'+Text(i), 'type':'esriFieldTypeString', Length:7}
        Push( fields , f )
        Values[ 'c'+Text(i) ] = GetPctColor(i)
        }
    }
Console( Values )
var Ramp = {
    'fields': fields,
    'geometryType':'',
    'features' : [{ attributes : Values }]
    }
Ramp = FeatureSet(Text(Ramp))
return Ramp&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 13:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596029#M24</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-03-17T13:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596038#M25</link>
      <description>&lt;P&gt;How are you using this script? Running it as is returns a FeatureSet&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_44c7d9.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128029iF3094A47783B7C6F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_44c7d9.png" alt="Snag_44c7d9.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 13:35:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596038#M25</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-03-17T13:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596052#M26</link>
      <description>&lt;P&gt;So the error that I came across is due to the featureset not likeing alphnumeric field names for integers or strings.&lt;/P&gt;&lt;P&gt;To bypass this; I created a list of alphabetical letters and then indexed those for the field names which seemed to bypass that issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetPctColor(P){
    var Color = When(
        P &amp;gt;= 0 &amp;amp;&amp;amp; P &amp;lt; 5,'#d01111',
        P &amp;gt;= 5 &amp;amp;&amp;amp; P &amp;lt; 10,'#cc2211',
        P &amp;gt;= 10 &amp;amp;&amp;amp; P &amp;lt; 15,'#c83311',
        P &amp;gt;= 15 &amp;amp;&amp;amp; P &amp;lt; 20,'#c34211',
        P &amp;gt;= 20 &amp;amp;&amp;amp; P &amp;lt; 25,'#bf5112',
        P &amp;gt;= 25 &amp;amp;&amp;amp; P &amp;lt; 30,'#bb5f12',
        P &amp;gt;= 30 &amp;amp;&amp;amp; P &amp;lt; 35,'#b76c12',
        P &amp;gt;= 35 &amp;amp;&amp;amp; P &amp;lt; 40,'#b37912',
        P &amp;gt;= 40 &amp;amp;&amp;amp; P &amp;lt; 45,'#af8512',
        P &amp;gt;= 45 &amp;amp;&amp;amp; P &amp;lt; 50,'#ab9012',
        P &amp;gt;= 50 &amp;amp;&amp;amp; P &amp;lt; 55,'#a79a12',
        P &amp;gt;= 55 &amp;amp;&amp;amp; P &amp;lt; 60,'#a2a312',
        P &amp;gt;= 60 &amp;amp;&amp;amp; P &amp;lt; 65,'#919f12',
        P &amp;gt;= 65 &amp;amp;&amp;amp; P &amp;lt; 70,'#819b12',
        P &amp;gt;= 70 &amp;amp;&amp;amp; P &amp;lt; 75,'#719712',
        P &amp;gt;= 75 &amp;amp;&amp;amp; P &amp;lt; 80,'#639312',
        P &amp;gt;= 80 &amp;amp;&amp;amp; P &amp;lt; 85,'#558f11',
        P &amp;gt;= 85 &amp;amp;&amp;amp; P &amp;lt; 90,'#478b11',
        P &amp;gt;= 90 &amp;amp;&amp;amp; P &amp;lt; 95,'#3b8711',
        '#2f8311'
        )
    return Color
    }
var Alph = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V']
var fields = []
var V = {}
var counter = 0
for( var i=5; i&amp;lt;= 95; i=i+5 ){
    if( i%5 == 0 ){
        var l = Alph[ counter ]
        var f = {'name':l, 'type':'esriFieldTypeSmallInteger'}
        Push( fields , f )
        V[ l ] = i
        var n = {'name':'c'+Text(i), 'type':'esriFieldTypeString', Length:7}
        Push( fields , n )
        V[ 'c'+Text(i) ] = GetPctColor(i)
        counter++
        }
    }

var Ramp = {
    'fields': fields,
    'geometryType':'',
    'features' : [{ attributes : V }]
    }
Ramp = FeatureSet(Text(Ramp))
return Ramp&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Mar 2025 14:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596052#M26</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-03-17T14:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596072#M27</link>
      <description>&lt;P&gt;It is ultimately, when combined with a modified html, to look like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RPGIS_0-1742221217822.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128031i7D56AD4150BC3920/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RPGIS_0-1742221217822.png" alt="RPGIS_0-1742221217822.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 14:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596072#M27</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-03-17T14:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596083#M28</link>
      <description>&lt;P&gt;There are a couple ways to simplify this script.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You don't need to check if the values are greater than the previous values in the if statement (line 4-21)&lt;/LI&gt;&lt;LI&gt;You don't need the Text function anywhere, since concatenating a string and a number will result in a string (lines 33 and 35)&lt;/LI&gt;&lt;LI&gt;You also don't need the Text function to create a FeatureSet from a Dictionary (line 44). This was fixed as while ago, possibly in &lt;A href="https://developers.arcgis.com/arcade/guide/release-notes/#version-119" target="_self"&gt;version 1.19&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;And you don't need the Alph array, since you can cast the variable i to a string also (lines 30 and 32).&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;function GetPctColor(P) {
  var Color = When(
    P &amp;gt;= 0 &amp;amp;&amp;amp; P &amp;lt; 5, "#d01111",
    P &amp;lt; 10, "#cc2211",
    P &amp;lt; 15, "#c83311",
    P &amp;lt; 20, "#c34211",
    P &amp;lt; 25, "#bf5112",
    P &amp;lt; 30, "#bb5f12",
    P &amp;lt; 35, "#b76c12",
    P &amp;lt; 40, "#b37912",
    P &amp;lt; 45, "#af8512",
    P &amp;lt; 50, "#ab9012",
    P &amp;lt; 55, "#a79a12",
    P &amp;lt; 60, "#a2a312",
    P &amp;lt; 65, "#919f12",
    P &amp;lt; 70, "#819b12",
    P &amp;lt; 75, "#719712",
    P &amp;lt; 80, "#639312",
    P &amp;lt; 85, "#558f11",
    P &amp;lt; 90, "#478b11",
    P &amp;lt; 95, "#3b8711",
    "#2f8311"
  );
  return Color;
}
var fields = [];
var V = {};
for (var i = 5; i &amp;lt;= 95; i = i + 5) {
  if (i % 5 == 0) {
    var f = { name: `${i}`, type: "esriFieldTypeSmallInteger" };
    Push(fields, f);
    V[`${i}`] = i;
    f = { name: "c" + i, type: "esriFieldTypeString", Length: 7 };
    Push(fields, f);
    V["c" + i] = GetPctColor(i);
  }
}

var Ramp = {
  fields: fields,
  geometryType: "",
  features: [{ attributes: V }]
};
return FeatureSet(Ramp);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 14:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596083#M28</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-03-17T14:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596226#M29</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;for showcasing a better way to write when statements. I am still working on improving the use of the functions and the concatenating text resulting in a text value I completely forgot about.&lt;/P&gt;&lt;P&gt;We are using a portal that is one version and several point releases behind the latest portal version, so somethings work and others don't. But next time we upgrade, I will be sure to update my code bases to better work using simpler code.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 17:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596226#M29</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-03-17T17:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596531#M30</link>
      <description>One inconsistency appears to be the type casting of the name in the 2nd line below. Shouldn't it also be a string type instead of an integer type?&lt;BR /&gt;&lt;BR /&gt;if( i%5 == 0 ){&lt;BR /&gt;&lt;BR /&gt;var f = {'name':'n'+Text(i), 'type':'esriFieldTypeSmallInteger'}&lt;BR /&gt;&lt;BR /&gt;Push( fields , f )&lt;BR /&gt;&lt;BR /&gt;Values[ 'n'+Text(i) ] = i&lt;BR /&gt;&lt;BR /&gt;f = {'name':'c'+Text(i), 'type':'esriFieldTypeString', Length:7}&lt;BR /&gt;&lt;BR /&gt;Push( fields , f )&lt;BR /&gt;&lt;BR /&gt;Values[ 'c'+Text(i) ] = GetPctColor(i)&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Mar 2025 13:34:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596531#M30</guid>
      <dc:creator>VictorGutzler</dc:creator>
      <dc:date>2025-03-18T13:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596557#M31</link>
      <description>&lt;P&gt;It can be a integer since the value that's being inserted into the field is an integer (line 4)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 14:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596557#M31</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-03-18T14:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Minor issue with arcade script that I typically don't run into.</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596641#M32</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/501127"&gt;@VictorGutzler&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The second line populates an array of field names using the field name dictionary and the value populates a dictionary which is later added to an array as values.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 16:35:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/minor-issue-with-arcade-script-that-i-typically/m-p/1596641#M32</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-03-18T16:35:20Z</dc:date>
    </item>
  </channel>
</rss>

