<?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: Compile array of domain codes using Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387400#M57710</link>
    <description>&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#schema" target="_self"&gt;Schema&lt;/A&gt; function to get the domain information for all the fields. This code gives you an array of an array of the fields and their codedValue domain names.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var dict = Schema($feature);
var fieldsArray = dict.fields;
var domainsArray = [];
for (var i in fieldsArray) {
  if (HasValue(fieldsArray[i], 'domain')) {
    if (HasValue(fieldsArray[i].domain, 'codedValues')) {
      var domainArray = [fieldsArray[i].name]
      for (var d in fieldsArray[i].domain['codedValues']) {
        Push(domainArray, fieldsArray[i].domain['codedValues'][d].name)
      }
      Push(domainsArray,domainArray)
    }
  }
}
return domainsArray&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="domains.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95965i20913C20EE7184AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="domains.png" alt="domains.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 15:12:28 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2024-02-27T15:12:28Z</dc:date>
    <item>
      <title>Compile array of domain codes using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387117#M57701</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I'm attempting to automatically compile an array of domain codes for comparison when deciding how to visualize a layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this is what I've got so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var codearray = Array(1)
var domain = Domain($feature, "Status")
var index = 0
var codedValues = domain.codedValues[index].code
for(var att in codedValues){
  Insert(codearray, 0, codedValues)
  index + 1
}
return codearray
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Results:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;array(4)
0: null
1: "Run"
2: "Run"
3: "Run"&lt;/LI-CODE&gt;&lt;P&gt;Input Data (results of Domain function)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;dictionary
codedValues: array(2)
0: dictionary
code: "Run"
name: "Run"
1: dictionary
code: "Standby"
name: "Standby"
dataType: "esriFieldTypeString"
name: "HydrantLoc_111319_Status_f1dd7c78-d63c-4b23-8d0d-a5f5c916c584"
type: "codedValue"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Results I'm looking for:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;array(2)
0: "Run"
1: "Standby"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then to take this a step further I'm looking to do this for multiple fields and then combine them into another array that contains every combination of value from each array. But maybe that's a problem for a different post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In Advance Yall!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 00:24:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387117#M57701</guid>
      <dc:creator>MattTarkington1</dc:creator>
      <dc:date>2024-02-27T00:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compile array of domain codes using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387400#M57710</link>
      <description>&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#schema" target="_self"&gt;Schema&lt;/A&gt; function to get the domain information for all the fields. This code gives you an array of an array of the fields and their codedValue domain names.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var dict = Schema($feature);
var fieldsArray = dict.fields;
var domainsArray = [];
for (var i in fieldsArray) {
  if (HasValue(fieldsArray[i], 'domain')) {
    if (HasValue(fieldsArray[i].domain, 'codedValues')) {
      var domainArray = [fieldsArray[i].name]
      for (var d in fieldsArray[i].domain['codedValues']) {
        Push(domainArray, fieldsArray[i].domain['codedValues'][d].name)
      }
      Push(domainsArray,domainArray)
    }
  }
}
return domainsArray&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="domains.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95965i20913C20EE7184AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="domains.png" alt="domains.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 15:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387400#M57710</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-02-27T15:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Compile array of domain codes using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387655#M57720</link>
      <description>&lt;P&gt;That worked perfectly. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 19:33:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/compile-array-of-domain-codes-using-arcade/m-p/1387655#M57720</guid>
      <dc:creator>MattTarkington1</dc:creator>
      <dc:date>2024-02-27T19:33:03Z</dc:date>
    </item>
  </channel>
</rss>

