<?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 - Dictionary with One Key and 2 Values in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1096129#M211</link>
    <description>&lt;P&gt;Thank you Johannes! This is the example I was looking for. Thanks again!&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 20:49:55 GMT</pubDate>
    <dc:creator>BradenWarns</dc:creator>
    <dc:date>2021-09-07T20:49:55Z</dc:date>
    <item>
      <title>Arcade - Dictionary with One Key and 2 Values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094134#M201</link>
      <description>&lt;P&gt;I am trying to create an attribute rule using a dictionary in Arcade for our Zoning layer. The dictionary will have one key and two values. I want to compare the values in the dictionary to two fields. However, I am not sure how to call each value in the expression.&lt;BR /&gt;&lt;BR /&gt;The idea is to use value one as my control against one field. Then update another field with value two.&lt;BR /&gt;&lt;BR /&gt;Ex:&lt;BR /&gt;&lt;BR /&gt;Value 1 = R-1&lt;/P&gt;&lt;P&gt;Value 2 = Single-Family District&lt;/P&gt;&lt;P&gt;Field 1 = R-1&lt;/P&gt;&lt;P&gt;Field 2 = Single-Family and Two-Family District&lt;/P&gt;&lt;P&gt;Value 1 == Field 1&lt;/P&gt;&lt;P&gt;Value 2 != Field 2&lt;/P&gt;&lt;P&gt;Therfore Field 2 will be update with the Value 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 19:11:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094134#M201</guid>
      <dc:creator>BradenWarns</dc:creator>
      <dc:date>2021-08-31T19:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Dictionary with One Key and 2 Values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094176#M202</link>
      <description>&lt;P&gt;You don't need a dictionary type to do this. I recently did something very similar on a zoning layer. The way I accomplished this was creating a definition query where value 2 != field 2 then I performed a calculate field on the remaining field where I used a loop like for (var i in Zoning){return i.nameoffieldyouwant})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 20:42:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094176#M202</guid>
      <dc:creator>IamTrash</dc:creator>
      <dc:date>2021-08-31T20:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Dictionary with One Key and 2 Values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094261#M203</link>
      <description>&lt;P&gt;Your example doesn't state what the dictionary keys would be. As it looks right now, you could just do this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Rule on Field 2
// Triggers: Update, Insert

// return early if Field1 is empty
if(IsEmpty($featue.Field1)) {
  return $feature.Field2  // or return null
}
// create the dictionary
var value_dict = {
  "R-1": "Single-Family District",
  "ABC": "Other stuff",
}
// return the right value for Field2
return value_dict[$feature.Field1]


// you could also do it with a list:
value_list = [
  ["R-1", "Single-Family District"],
  ["ABC", "Other stuff"],
]
for(var i in value_list) {
  if(value_list[i][0] == $feature.Field1) {
    return value_list[i][1]
  }
}
// return a default value if Field1 is not in the list
return null&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 01 Sep 2021 06:11:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1094261#M203</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-01T06:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - Dictionary with One Key and 2 Values</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1096129#M211</link>
      <description>&lt;P&gt;Thank you Johannes! This is the example I was looking for. Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 20:49:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-dictionary-with-one-key-and-2-values/m-p/1096129#M211</guid>
      <dc:creator>BradenWarns</dc:creator>
      <dc:date>2021-09-07T20:49:55Z</dc:date>
    </item>
  </channel>
</rss>

