<?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 Field Maps: calculated expression (arcade) to fill a field when another one has a specific value in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1300671#M6333</link>
    <description>&lt;P&gt;Hey guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit new to arcade and trying to figure out how to do a simple expression in field maps to fill in a value.&lt;BR /&gt;&lt;BR /&gt;I have field1 with a string and field2&amp;nbsp;with two possible values via domains. If in field1 a specific string is chosen, I want field2 to select the correct value (from the domain) automatically.&lt;/P&gt;&lt;P&gt;I tried it like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.field1 == "string 1") {
  var output = DomainName($feature, "field2", 1);
  return output;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or without specifying that it's a domain:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.field1 == "string 1") {
  var output = "string2";
  return output;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im not sure if the second option is possible because there is a domain set on the field.&lt;BR /&gt;But nevertheless, both didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me? It's probably simple and I don't get something right.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2023 11:30:45 GMT</pubDate>
    <dc:creator>MichelleMarek</dc:creator>
    <dc:date>2023-06-19T11:30:45Z</dc:date>
    <item>
      <title>Field Maps: calculated expression (arcade) to fill a field when another one has a specific value</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1300671#M6333</link>
      <description>&lt;P&gt;Hey guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit new to arcade and trying to figure out how to do a simple expression in field maps to fill in a value.&lt;BR /&gt;&lt;BR /&gt;I have field1 with a string and field2&amp;nbsp;with two possible values via domains. If in field1 a specific string is chosen, I want field2 to select the correct value (from the domain) automatically.&lt;/P&gt;&lt;P&gt;I tried it like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.field1 == "string 1") {
  var output = DomainName($feature, "field2", 1);
  return output;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or without specifying that it's a domain:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.field1 == "string 1") {
  var output = "string2";
  return output;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im not sure if the second option is possible because there is a domain set on the field.&lt;BR /&gt;But nevertheless, both didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me? It's probably simple and I don't get something right.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 11:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1300671#M6333</guid>
      <dc:creator>MichelleMarek</dc:creator>
      <dc:date>2023-06-19T11:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Field Maps: calculated expression (arcade) to fill a field when another one has a specific value</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1314409#M6680</link>
      <description>&lt;P&gt;This may be something you've already finished by now, but have you tried something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;if ($feature.field1 == "string 1") {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return 1&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;It seems like maybe the domain code is what needs to be output but both of the code snips are returning the domain name instead.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 00:47:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1314409#M6680</guid>
      <dc:creator>LuisaC</dc:creator>
      <dc:date>2023-08-02T00:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field Maps: calculated expression (arcade) to fill a field when another one has a specific value</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1314492#M6683</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;BR /&gt;I figured it out with your input. It's not quite like your example but your suggestion about returning the domain code was right.&lt;/P&gt;&lt;P&gt;It works like that:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (DomainName($feature, "field1") == "string1") {
  return 1
}&lt;/LI-CODE&gt;&lt;P&gt;So I tried some things and it only works that way. The domain code has to be returned (not the string) and it seems that for the clause, you have to use the DomainName function (I selected it like that from the variable selection in the arcade editor).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But because it only works over the domains, I can't use it for an attribute with different domains depending on subtypes. The Arcade Editor doesn't seem to recognize these domain values.&lt;BR /&gt;But for me it kind of works when I use a different attribute.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 11:53:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-calculated-expression-arcade-to-fill-a/m-p/1314492#M6683</guid>
      <dc:creator>MichelleMarek</dc:creator>
      <dc:date>2023-08-02T11:53:41Z</dc:date>
    </item>
  </channel>
</rss>

