<?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: Calculated fields in ArcGIS Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343124#M74589</link>
    <description>&lt;P&gt;Thanks all for helping with this, I took another look at it and figured this code was way too simple to be giving this much trouble and I made a guess that the only other complication to this was that I was using a Domain. I was using the description of the code in the domain and that was the issue&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":weary_face:"&gt;😩&lt;/span&gt;. Once I switched&amp;nbsp;"Yellow_Floating_Heart" for&amp;nbsp;"Yellow Floating Heart" in the script:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if (commonName == "Yellow_Floating_Heart") {
    scientificName = "Nymphoides peltate";&lt;/LI-CODE&gt;&lt;P&gt;it worked as expected. I slipped up on that. Thanks everyone for helping with this.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-10-29 123513.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84393iDBFD460EDA1E62F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-10-29 123513.png" alt="Screenshot 2023-10-29 123513.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 29 Oct 2023 16:39:46 GMT</pubDate>
    <dc:creator>AleemMohammed</dc:creator>
    <dc:date>2023-10-29T16:39:46Z</dc:date>
    <item>
      <title>Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342736#M74550</link>
      <description>&lt;DIV class=""&gt;Hi Everyone,&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I am new to using ArcGIS Pro and Arcade, I wanted to have a few calculated fields in my table, not sure what's going wrong.&amp;nbsp; I wanted the user to choose a value for the CommonName field and the app would fill out the ScientificName field. So I tried using the Arcade syntax, this was what I came&amp;nbsp;up&amp;nbsp;with:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var commonName = $feature.CommonName;
var scientificName = "";

if (commonName == "Yellow Floating Heart") {
    scientificName = "Nymphoides peltate";
} else if (commonName == "Japanese Knotweed") {
    scientificName = "Reynoutria japonica";
} else if (commonName == "Invasive Phragmites") {
    scientificName = "Phragmites australis";
} else if (commonName == "Himalayan knotweed") {
    scientificName = "Koenigia polystachya";
} else if (commonName == "Giant knotweed") {
    scientificName = "Reynoutria sachalinensis";
} else if (commonName == "Fanwort") {
    scientificName = "Cabomba caroliniana";
} else if (commonName == "European frogbit") {
    scientificName = "Hydrocharis morsus-ranae";
} else if (commonName == "Dog-Strangling Vine") {
    scientificName = "Vincetoxicum rossicum";
} else if (commonName == "Bohemian knotweed") {
    scientificName = "Reynoutria ×bohemica";
} else if (commonName == "Black dog-strangling vine") {
    scientificName = "Vincetoxicum nigrum";
    return scientificName;
} else {
    // Default value if no match is found
    scientificName = "What";
}

return scientificName;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;I know the script is reading the correct value for the CommonName because if I set the scientifiName to CommonName the value is filled in the field. However, my script is returning "What", do you know where I might have gone wrong with this?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Regards,&lt;DIV&gt;Aleem&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-10-27 095738.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84287iC335763C6DF4D57F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-10-27 095738.png" alt="Screenshot 2023-10-27 095738.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 Oct 2023 15:43:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342736#M74550</guid>
      <dc:creator>AleemMohammed</dc:creator>
      <dc:date>2023-10-27T15:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342770#M74551</link>
      <description>&lt;P&gt;You might find setting up domains helpful.&amp;nbsp;&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/create-modify-and-delete-domains.htm" target="_self"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/create-modify-and-delete-domains.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 16:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342770#M74551</guid>
      <dc:creator>CarlMorrison</dc:creator>
      <dc:date>2023-10-27T16:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342772#M74553</link>
      <description>&lt;P&gt;Is it possible there's an extra space in the Common Name field ("Yellow Floating Heart ")? Is there any change if you modify the first line?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var commonName = Trim($feature.CommonName);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;You could also use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; function to simplify your code (also using an &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;Implicit return&lt;/A&gt;)&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var commonName = Trim($feature.CommonName);

When (commonName == "Yellow Floating Heart", "Nymphoides peltate",
      commonName == "Japanese Knotweed", "Reynoutria japonica",
      commonName == "Invasive Phragmites", "Phragmites australis",
      commonName == "Himalayan knotweed", "Koenigia polystachya",
      commonName == "Giant knotweed", "Reynoutria sachalinensis",
      commonName == "Fanwort", "Cabomba caroliniana",
      commonName == "European frogbit", "Hydrocharis morsus-ranae",
      commonName == "Dog-Strangling Vine", "Vincetoxicum rossicum",
      commonName == "Bohemian knotweed", "Reynoutria ×bohemica",
      commonName == "Black dog-strangling vine", "Vincetoxicum nigrum",
      "What")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 16:17:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1342772#M74553</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-10-27T16:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343038#M74581</link>
      <description>&lt;P&gt;Hi Carl,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did set up a domain for the CommonName field and that's what I'm using.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 14:11:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343038#M74581</guid>
      <dc:creator>AleemMohammed</dc:creator>
      <dc:date>2023-10-28T14:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343041#M74582</link>
      <description>&lt;P&gt;I don't believe so, I'm using a domain for the data entry on CommonName and I copied and pasted the names from the domain table to the cod&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-10-28 101225.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84353i20D9AB6D88FD2F2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-10-28 101225.png" alt="Screenshot 2023-10-28 101225.png" /&gt;&lt;/span&gt;e.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 14:13:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343041#M74582</guid>
      <dc:creator>AleemMohammed</dc:creator>
      <dc:date>2023-10-28T14:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343124#M74589</link>
      <description>&lt;P&gt;Thanks all for helping with this, I took another look at it and figured this code was way too simple to be giving this much trouble and I made a guess that the only other complication to this was that I was using a Domain. I was using the description of the code in the domain and that was the issue&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":weary_face:"&gt;😩&lt;/span&gt;. Once I switched&amp;nbsp;"Yellow_Floating_Heart" for&amp;nbsp;"Yellow Floating Heart" in the script:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if (commonName == "Yellow_Floating_Heart") {
    scientificName = "Nymphoides peltate";&lt;/LI-CODE&gt;&lt;P&gt;it worked as expected. I slipped up on that. Thanks everyone for helping with this.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-10-29 123513.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84393iDBFD460EDA1E62F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-10-29 123513.png" alt="Screenshot 2023-10-29 123513.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 16:39:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343124#M74589</guid>
      <dc:creator>AleemMohammed</dc:creator>
      <dc:date>2023-10-29T16:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343274#M74617</link>
      <description>&lt;P&gt;What you also could have done is used the &lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#domainname" target="_self"&gt;DomainName&lt;/A&gt; function to get the descriptive name.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var commonName = DomainName($feature, "CommonName");

When (commonName == "Yellow Floating Heart", "Nymphoides peltate",
      commonName == "Japanese Knotweed", "Reynoutria japonica",
      commonName == "Invasive Phragmites", "Phragmites australis",
      commonName == "Himalayan knotweed", "Koenigia polystachya",
      commonName == "Giant knotweed", "Reynoutria sachalinensis",
      commonName == "Fanwort", "Cabomba caroliniana",
      commonName == "European frogbit", "Hydrocharis morsus-ranae",
      commonName == "Dog-Strangling Vine", "Vincetoxicum rossicum",
      commonName == "Bohemian knotweed", "Reynoutria ×bohemica",
      commonName == "Black dog-strangling vine", "Vincetoxicum nigrum",
      "What")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 14:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculated-fields-in-arcgis-pro/m-p/1343274#M74617</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-10-30T14:29:53Z</dc:date>
    </item>
  </channel>
</rss>

