<?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: Managed expression. Arcade help for beginner. in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133639#M1073</link>
    <description>&lt;P&gt;Thanks for all your help&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;! Learned a lot today. I've realised some of the casing I had in the drop downs wasn't matching up with what I'd put in the expression, so I need to go back through the full thing. Things should work then.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2022 22:12:27 GMT</pubDate>
    <dc:creator>Marokapara</dc:creator>
    <dc:date>2022-01-13T22:12:27Z</dc:date>
    <item>
      <title>Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133552#M1069</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I've made two expressions EF and Ha using Arcade that I'd like to use in a Map Viewer pop-up. I've created them in the Managed Expressions area.&lt;/P&gt;&lt;P&gt;If I want to use both of them to create an additional expression, how do I do this?&lt;/P&gt;&lt;P&gt;I'm still new to Arcade and don't have a background as a coder.&lt;/P&gt;&lt;P&gt;Hopefully this is an easy question for someone!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Marokapara_0-1642100688195.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31447i4DE96EE6AC6F4E6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Marokapara_0-1642100688195.png" alt="Marokapara_0-1642100688195.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Marokapara_1-1642100728690.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31448i2ACFB90F3F4F23A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Marokapara_1-1642100728690.png" alt="Marokapara_1-1642100728690.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried $feature.EF/$feature.Ha. That doesn't work though because $feature are fields written into the table and Arcade is front end only?&lt;/P&gt;&lt;P&gt;&lt;U&gt;EF's expression looks like this.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;When($feature.ParameterTotal=='No vegetation Utility areas (tracks, buildings, yards)', 0,&lt;BR /&gt;$feature.ParameterTotal=='No vegetation Ponds/river/stream', 1,&lt;BR /&gt;$feature.ParameterTotal=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Fertilised', 2,&lt;/P&gt;&lt;P&gt;'No value');&lt;/P&gt;&lt;P&gt;Note: I will also need to swap out $feature.ParameterTotal to Parameter Total (Web arcade version). Currently I have it hardcoded while I try to figure out the correct expression syntax.&lt;/P&gt;&lt;P&gt;&lt;U&gt;Ha's expression looks like this.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Round($feature.Shape__Area/10000,2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 19:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133552#M1069</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-13T19:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133555#M1070</link>
      <description>&lt;P&gt;This is easy enough if you use &lt;STRONG&gt;variables&lt;/STRONG&gt; in your expression. Just use the syntax "var &amp;lt;name&amp;gt; = &amp;lt;expression&amp;gt;", and you can re-reference that variable later. Combining your expressions would look like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var EF = When(
    $feature.ParameterTotal=='No vegetation Utility areas (tracks, buildings, yards)', 0,
    $feature.ParameterTotal=='No vegetation Ponds/river/stream', 1,
    $feature.ParameterTotal=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Fertilised', 2,
    'No value'
);

var Ha = Round($feature.Shape__Area/10000,2);

return EF / Ha&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 19:31:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133555#M1070</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-13T19:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133575#M1071</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;, thanks for this.&lt;/P&gt;&lt;P&gt;What about if I have a negative value in the When() statement? I'm getting NaN sometimes as output.&lt;/P&gt;&lt;P&gt;Also, I want to switch out $feature.ParameterTotal to a variable (TotalTrim) before the start of the entire expression.&lt;/P&gt;&lt;P&gt;Would it look like this?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var Total = Concatenate([$feature.Parameter1,$feature.P2,$feature.P3, $feature.P4],'  ')
var TotalTrim = Trim(Total)

var EF = When(
    TotalTrim=='No vegetation Utility areas (tracks, buildings, yards)', 0,
    TotalTrim=='No vegetation Ponds/river/stream', 1,
    TotalTrim=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Fertilised', -2,
    'No value'
);

var Ha = Round($feature.Shape__Area/10000,2);

return EF / Ha&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 20:03:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133575#M1071</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-13T20:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133586#M1072</link>
      <description>&lt;P&gt;You'd need to set your default output to another number instead of 'no value'. When your script goes to divide the text "no value" by &lt;STRONG&gt;Ha&lt;/STRONG&gt;, it gives a NaN, since that doesn't make sense.&lt;/P&gt;&lt;P&gt;You might consider an &lt;STRONG&gt;If&lt;/STRONG&gt; statement to check for that value and return something else.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Total = Concatenate([$feature.Parameter1,$feature.P2,$feature.P3, $feature.P4],'  ')
var TotalTrim = Trim(Total)

var EF = When(
    TotalTrim=='No vegetation Utility areas (tracks, buildings, yards)', 0,
    TotalTrim=='No vegetation Ponds/river/stream', 1,
    TotalTrim=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Fertilised', -2,
    'No value'
);

var Ha = Round($feature.Shape__Area/10000,2);

If ( EF == 'No value' ){
    return 'No value'
} else {
    return EF / Ha
}&lt;/LI-CODE&gt;&lt;P&gt;The rest of the expression looks good, though.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 20:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133586#M1072</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-13T20:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133639#M1073</link>
      <description>&lt;P&gt;Thanks for all your help&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;! Learned a lot today. I've realised some of the casing I had in the drop downs wasn't matching up with what I'd put in the expression, so I need to go back through the full thing. Things should work then.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 22:12:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1133639#M1073</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-13T22:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136288#M1079</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906" target="_blank" rel="noopener"&gt;@jcarlson&lt;/A&gt;&amp;nbsp;I've gotten the expression to work... for the first two EF options. There are still 125 to go. I'm not sure what I've done wrong. The syntax looks the same '', spacing wise, letter casing and spelling.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snip of 5 of them. I can get these first two to output correctly, but the following three come up as no value. (Thanks for that no value explanation higher up in the post.)&lt;/P&gt;&lt;PRE&gt;var Total = Concatenate([$feature.Parameter1, $feature.P2_NoVeg, $feature.P2_NonWoodVeg, $feature.P2_MixedWoodNonWood, $feature.P2_WoodVeg, $feature.P3_NonWoodVeg_Graze, $feature.P3_MixedWoodNonWood_Graze, $feature.P3_WoodVeg_Riparian, $feature.P4_NonWoodVeg_NotGrazed, $feature.P4_WoodVeg_Riparian_Native, $feature.P5_NonWoodVeg_Fert, $feature.P5_WoodVeg_NatGen, $feature.P6_NonWoodVeg_NotFert, $feature.P6_WoodVeg_NotIrrigated],'  ')
var TotalTrim = Trim(Total)

var EF = When(
    TotalTrim=='No vegetation  Utility areas (tracks, buildings, yards)', 0,
    TotalTrim=='No vegetation  Ponds/river/stream', 1,
    TotalTrim=='Non-woody vegetation  Wetland/swamp/bog  Grazed by animals  Cultivated  Fertilised', -2,
    TotalTrim=='Non-woody vegetation  Wetland/swamp/bog  Grazed by animals  Cultivated  Not fertilised', -3,
    'No value'
);

If ( EF == 'No value' ){
    return 'No value'
} else {
    return EF
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 08:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136288#M1079</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-24T08:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136292#M1080</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906" target="_blank" rel="noopener"&gt;@jcarlson&lt;/A&gt;&amp;nbsp;I've gotten the expression to work... for the first two EF options. There are still 125 to go. I'm not sure what I've done wrong. The syntax looks the same '', spacing wise, letter casing and spelling.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snip of 5 of them. I can get these first two to output correctly, but the following three come up as no value. (Thanks for that no value explanation higher up in the post.)&lt;/P&gt;&lt;PRE&gt;var Total = Concatenate([$feature.Parameter1, $feature.P2_NoVeg, $feature.P2_NonWoodVeg, $feature.P2_MixedWoodNonWood, $feature.P2_WoodVeg, $feature.P3_NonWoodVeg_Graze, $feature.P3_MixedWoodNonWood_Graze, $feature.P3_WoodVeg_Riparian, $feature.P4_NonWoodVeg_NotGrazed, $feature.P4_WoodVeg_Riparian_Native, $feature.P5_NonWoodVeg_Fert, $feature.P5_WoodVeg_NatGen, $feature.P6_NonWoodVeg_NotFert, $feature.P6_WoodVeg_NotIrrigated],'  ')
var TotalTrim = Trim(Total)

var EF = When(
    TotalTrim=='No vegetation  Utility areas (tracks, buildings, yards)', 0,
    TotalTrim=='No vegetation  Ponds/river/stream', 1,
    TotalTrim=='Non-woody vegetation  Wetland/swamp/bog  Grazed by animals  Cultivated  Fertilised', -2,
    TotalTrim=='Non-woody vegetation  Wetland/swamp/bog  Grazed by animals  Cultivated  Not fertilised', -3,
    'No value'
);

If ( EF == 'No value' ){
    return 'No value'
} else {
    return EF
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 08:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136292#M1080</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-24T08:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136552#M1082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;, I changed the casing and thought I'd be good to go. I'm able to get the first two (No vegetation types) to output correctly, but when I try any of the others, I get no value. They should be outputting the last number in each of the lines.&lt;/P&gt;&lt;P&gt;I'm not sure what I'm doing wrong. The '', casing, spacing and spelling all look correct.&lt;/P&gt;&lt;P&gt;There are over 100 possible outputs, but I can only get the first two to work. This is a snippet of five. Is there anything I've done wrong? Maybe syntax wise?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Total = Concatenate([$feature.Parameter1, $feature.P2_NoVeg, $feature.P2_NonWoodVeg, $feature.P2_MixedWoodNonWood, $feature.P2_WoodVeg, $feature.P3_NonWoodVeg_Graze, $feature.P3_MixedWoodNonWood_Graze, $feature.P3_WoodVeg_Riparian, $feature.P4_NonWoodVeg_NotGrazed, $feature.P4_WoodVeg_Riparian_Native, $feature.P5_NonWoodVeg_Fert, $feature.P5_WoodVeg_NatGen, $feature.P6_NonWoodVeg_NotFert, $feature.P6_WoodVeg_NotIrrigated],' ')

var EF = When(
TotalTrim=='No vegetation Utility areas (tracks, buildings, yards)', 0,
TotalTrim=='No vegetation Ponds/river/stream', 1,
TotalTrim=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Fertilised', -2,
TotalTrim=='Non-woody vegetation Wetland/swamp/bog Grazed by animals Cultivated Not fertilised', -3,
'No value'
);

If ( EF == 'No value' ){
    return 'No value'
} else {
    return EF
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 19:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136552#M1082</guid>
      <dc:creator>Marokapara</dc:creator>
      <dc:date>2022-01-24T19:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136567#M1083</link>
      <description>&lt;P&gt;It's hard to say what might be going wrong. Is it possible to try and tackle this further upstream? For instance, if you used coded domains on these fields, it would be possible to represent each combination as a series of single digits, rather than these increasingly long strings of text.&lt;/P&gt;&lt;P&gt;Also, it looks like there are values being sort of "doubled" in your attributes. For instance, you've got "non wood veg" and "wood veg", then other attributes like "non wood veg not grazed" and "wood veg not irrigated".&lt;/P&gt;&lt;P&gt;Would it not make more sense to simply have "wood veg", "grazed", and "irrigated" with yes/no values in them? I think you'll have an easier time working with your data that way.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 20:11:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136567#M1083</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-24T20:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Managed expression. Arcade help for beginner.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136679#M1084</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;Thank you for your help so far. I'll try and put domain names, use the yes/no strategy or try and attack this from a different angle.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 00:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/managed-expression-arcade-help-for-beginner/m-p/1136679#M1084</guid>
      <dc:creator>elpinguino</dc:creator>
      <dc:date>2022-01-25T00:29:34Z</dc:date>
    </item>
  </channel>
</rss>

