<?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: Arcade: Calculate a Field in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270567#M7513</link>
    <description>&lt;LI-CODE lang="javascript"&gt;var codes = {
    "Very bad": 0,
    "Bad": 1,
    "Good": 2,
    "Very good": 3,
}

if(HasKey(codes, $feature.StringField)) {
    return codes[$feature.StringField]
}
return 999 // default value if you forgot a code&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 22 Mar 2023 18:59:02 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-03-22T18:59:02Z</dc:date>
    <item>
      <title>Arcade: Calculate a Field</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270542#M7511</link>
      <description>&lt;P&gt;Hi everyone!&lt;BR /&gt;I'm relatively new to Arcade and i'm trying to calculate a calculate Field in FeatureSet.&lt;/P&gt;&lt;P&gt;Basicly I have a String Field with domains. I want to create a new field that turns those string domains into numbers so I can have a custom order in my serial chart in Dashboards.&lt;/P&gt;&lt;P&gt;For exemple, I have the values: Very bad; Bad; Good; Very Good;&lt;BR /&gt;I need to create a new field that turns those values into numbers: Very bad = 0; Bad = 1; Good = 2; Very Good = 3;&lt;/P&gt;&lt;P&gt;Any idea on how to start?&lt;BR /&gt;Thanks!!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270542#M7511</guid>
      <dc:creator>arc_ticodex</dc:creator>
      <dc:date>2023-03-22T18:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Calculate a Field</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270547#M7512</link>
      <description>&lt;P&gt;Check out the &lt;STRONG&gt;Decode&lt;/STRONG&gt; function, which is actually being used to "encode" your data in this case.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var string_field = $feature['your_field']

var coded_field = Decode(
    string_field,
    'Very bad', 0,
    'Bad', 1,
    'Good', 2,
    'Very Good', 3,
    -1 // the function wants a default value when no conditions are met, so we'll use -1
)

return coded_field&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270547#M7512</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-22T18:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Calculate a Field</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270567#M7513</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var codes = {
    "Very bad": 0,
    "Bad": 1,
    "Good": 2,
    "Very good": 3,
}

if(HasKey(codes, $feature.StringField)) {
    return codes[$feature.StringField]
}
return 999 // default value if you forgot a code&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:59:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-calculate-a-field/m-p/1270567#M7513</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-22T18:59:02Z</dc:date>
    </item>
  </channel>
</rss>

