<?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 Expression Symbology Difficulties in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1267338#M50876</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;, thanks for the feedback. I forgot to mention that Stage 3 will be empty if either Stage 1 Fails and Stage 2 Fails. This stage 3 will be "Pass" only if both Stage 1 and Stage 2 pass. Otherwise, it will be empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to re-write the expression by leaving it empty in the quotations but it returns "SomeDefaultValue" rather than the variations I state.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var Stage1= $feature.inspectionresult&lt;BR /&gt;var Stage2= $feature.installationresults&lt;BR /&gt;var Stage3= $feature["ns_serviceentrance"]&lt;/P&gt;&lt;P&gt;return When(&lt;BR /&gt;Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3==" ", "Stage 1 Pass Stage 2 Fail",&lt;BR /&gt;Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-2-3 Pass",&lt;BR /&gt;Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3==" ", "Stage 1 Fail Stage 2 Pass",&lt;BR /&gt;Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3==" ", "Stage 1-2 Fail",&lt;/P&gt;&lt;P&gt;"SomeDefaultValue"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I also tried entering "NULL" and still got the breakdown as on image.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-03-13_15-58-05.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65152i0D55F21859943B38/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-03-13_15-58-05.png" alt="2023-03-13_15-58-05.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2023 21:59:10 GMT</pubDate>
    <dc:creator>VaneiriPatt</dc:creator>
    <dc:date>2023-03-13T21:59:10Z</dc:date>
    <item>
      <title>Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266698#M50835</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to figure out a meaningful symbology for my data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a submission that has 3 stages on which they either pass or fail. I want to be able to symbolize based on the main two stages and the third would only be if first two stages pass.&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the variations I want to achieve when symbolizing:&lt;/P&gt;&lt;P&gt;Stage 1 &amp;amp; Stage 2 Pass&lt;/P&gt;&lt;P&gt;Stage 1 Pass &amp;amp; Stage 2 Fail&lt;/P&gt;&lt;P&gt;Stage 1 Fail &amp;amp; Stage 2 Pass&lt;/P&gt;&lt;P&gt;Stage 1 , 2, 3 Pass.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the sample expression I have written but it doesn't show what I need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var Stage1P= $feature.inspectionresult&lt;BR /&gt;if (Stage1P=="Pass")&lt;BR /&gt;return "Stage 1 Pass";&lt;/P&gt;&lt;P&gt;var Stage1F= $feature.inspectionresult&lt;BR /&gt;if (Stage1F=="Fail")&lt;BR /&gt;return "Stage 1 Fail";&lt;/P&gt;&lt;P&gt;var Stage2P= $feature.installationresults&lt;BR /&gt;if (Stage2P=="Pass")&lt;BR /&gt;return "Stage 2 Pass";&lt;/P&gt;&lt;P&gt;var Stage2F= $feature.installationresults&lt;BR /&gt;if (Stage2F=="Fail")&lt;BR /&gt;return "Stage 2 Fail";&lt;/P&gt;&lt;P&gt;var Stage3P=$feature["ns_serviceentrance"]&lt;BR /&gt;if (Stage3P=="Pass")&lt;BR /&gt;return "Stage 3 Pass";&lt;/P&gt;&lt;P&gt;var Stage3F=$feature["ns_serviceentrance"]&lt;BR /&gt;if (Stage3F=="Fail")&lt;BR /&gt;return "Stage 3 Fail"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (Stage1F=="Fail" &amp;amp;&amp;amp; Stage2P=="Pass")&lt;BR /&gt;return "Stage 1 Fail &amp;amp; Stage 2 Pass"&lt;/P&gt;&lt;P&gt;if (Stage1P=="Pass" &amp;amp;&amp;amp; Stage2F=="Fail")&lt;BR /&gt;return "Stage 1 Pass &amp;amp; Stage 2 Fail"&lt;/P&gt;&lt;P&gt;if (Stage1P=="Pass" &amp;amp;&amp;amp; Stage2P=="Pass" &amp;amp;&amp;amp; Stage3P=="Pass")&lt;BR /&gt;return "Stage 1-2-3 Pass"&lt;/P&gt;&lt;P&gt;Appreciate any help on this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 21:41:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266698#M50835</guid>
      <dc:creator>VaneiriPatt</dc:creator>
      <dc:date>2023-03-10T21:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266779#M50838</link>
      <description>&lt;P&gt;Looks like your code logic doesn't really work.&amp;nbsp; If inspectionResult is always either pass or fail, then only the first 2 if statements would ever be evaluated since a return breaks any subsequent evaluations (also consider using 'else if' to make the code more efficient.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you need some more detailed logic such as&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//8 possible permutations (2^3) (ermmmm I think - a while since my statistics classses!)
var Stage1= $feature.inspectionresult
var Stage2= $feature.installationresults
var Stage3= $feature.ns_serviceentrance

if (Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Fail")
return "Stage 1 Pass Stage 2-3 Fail"

else if (Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Fail")
return "Stage 1-2 Pass Stage 3 Fail"

else if (Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Pass")
return "Stage 1-3 Pass Stage 2 Fail"

else if (Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass")
return "Stage 1-2-3 Pass"

else if (Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass")
return "Stage 1 Fail Stage 2-3 pass"

else if (Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Pass")
return "Stage 1-2 Fail Stage 3 pass"

else if (Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Fail")
return "Stage 1-3 Fail Stage 2 pass"

else if (Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Fail")
return "Stage 1-2-3 Fail"
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 00:17:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266779#M50838</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-11T00:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266822#M50840</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;consider using 'else if' to make the code more efficient&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;If I'm not mistaken, that won't do anything here. If the condition is evaluated to be false, the following block is skipped, and the next condition is evaluated, regardless of if you use "if " or "else if". And if the condition evaluates to true, then the following block will be entered, and then the expression returns, skipping everything after that (as you said).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In terms of &lt;STRONG&gt;writing&lt;/STRONG&gt; efficiency, you could do this a little easier with When():&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return When(
  Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Fail", "Stage 1 Pass Stage 2-3 Fail",
  Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Fail", "Stage 1-2 Pass Stage 3 Fail",
  Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-3 Pass Stage 2 Fail",
  Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-2-3 Pass",
  Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1 Fail Stage 2-3 pass",
  Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-2 Fail Stage 3 pass",
  Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Fail", "Stage 1-3 Fail Stage 2 pass",
  Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3=="Fail", "Stage 1-2-3 Fail",
  "SomeDefaultValue"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if we go down the path of writing efficiency, this is still quite bad.&lt;/P&gt;&lt;P&gt;For the 8 permutations in this case, writing out all of them is still feasible. But imagine you'd need to add a fourth stage or another possible evaluation result (eg "undetermined"). Then we have 16 (4^2) or 27 (3^3) possible permutations. It quickly becomes unfeasible to write them all out.&lt;/P&gt;&lt;P&gt;In these cases, it's much more effcient (at least in terms of writing the expression, no idea about execution), to work with arrays/dictionaries:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var stages = [
    $feature.inspectionresult,
    $feature.installationresults,
    $feature.ns_serviceentrance,
]
var possible = ["Pass", "Fail"]

var values = Dictionary()
for(var i in stages) {
    var v = stages[i]
    Console(v)
    if(HasKey(values, v)) { Push(values[v], i + 1) }
    else { values[v] = [i + 1] }
}
var parts = []
for(var i in possible) {
    var v = possible[i]
    if(!HasKey(values, v)) { continue }
    Push(parts, "Stage " + Concatenate(values[v], "-") + " " + v)
}
return Concatenate(parts, " &amp;amp; ")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, if we want to add another stage and/or another possible result, we just have to edit the two variables:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1678537975952.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65036i793E25C1FABDEA1C/image-size/large?v=v2&amp;amp;px=999" role="button" title="JohannesLindner_0-1678537975952.png" alt="JohannesLindner_0-1678537975952.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 12:34:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266822#M50840</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-11T12:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266823#M50841</link>
      <description>&lt;P&gt;Impressive stuff there.&amp;nbsp; Yes on looking back, 'else if' makes no difference since a return statement is used each time.&amp;nbsp; 'When' is certainly more readable also.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 12:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1266823#M50841</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-11T12:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1267338#M50876</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;, thanks for the feedback. I forgot to mention that Stage 3 will be empty if either Stage 1 Fails and Stage 2 Fails. This stage 3 will be "Pass" only if both Stage 1 and Stage 2 pass. Otherwise, it will be empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to re-write the expression by leaving it empty in the quotations but it returns "SomeDefaultValue" rather than the variations I state.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var Stage1= $feature.inspectionresult&lt;BR /&gt;var Stage2= $feature.installationresults&lt;BR /&gt;var Stage3= $feature["ns_serviceentrance"]&lt;/P&gt;&lt;P&gt;return When(&lt;BR /&gt;Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3==" ", "Stage 1 Pass Stage 2 Fail",&lt;BR /&gt;Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-2-3 Pass",&lt;BR /&gt;Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3==" ", "Stage 1 Fail Stage 2 Pass",&lt;BR /&gt;Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail" &amp;amp;&amp;amp; Stage3==" ", "Stage 1-2 Fail",&lt;/P&gt;&lt;P&gt;"SomeDefaultValue"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I also tried entering "NULL" and still got the breakdown as on image.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-03-13_15-58-05.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65152i0D55F21859943B38/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-03-13_15-58-05.png" alt="2023-03-13_15-58-05.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 21:59:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1267338#M50876</guid>
      <dc:creator>VaneiriPatt</dc:creator>
      <dc:date>2023-03-13T21:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression Symbology Difficulties</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1267432#M50881</link>
      <description>&lt;P&gt;You could use IsEmpty(Stage3), which will return true for null and "" (and some other values). But if if Stage3 is dependent on both previous stages passing, you can just leave it out of those conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Stage1= $feature.inspectionresult
var Stage2= $feature.installationresults
var Stage3= $feature["ns_serviceentrance"]

return When(
    Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Fail", "Stage 1 Pass Stage 2 Fail",
    Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Pass", "Stage 1 Fail Stage 2 Pass",
    Stage1=="Fail" &amp;amp;&amp;amp; Stage2=="Fail", "Stage 1-2 Fail",
    Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Pass", "Stage 1-2-3 Pass",
    Stage1=="Pass" &amp;amp;&amp;amp; Stage2=="Pass" &amp;amp;&amp;amp; Stage3=="Fail", "Stage 1-2 Pass Stage 3 Fail",
    "You missed a condition!"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 08:44:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-symbology-difficulties/m-p/1267432#M50881</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-14T08:44:54Z</dc:date>
    </item>
  </channel>
</rss>

