<?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: Conditional field showing using arcade in map viewer popups in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1233523#M48976</link>
    <description>&lt;P&gt;I know it works with Map Viewer Classic, but it should also work with the new Map Viewer.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Nov 2022 18:18:03 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-11-19T18:18:03Z</dc:date>
    <item>
      <title>Conditional field showing using arcade in map viewer popups</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179071#M46257</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I am new to arcade and have mostly only used it in field map forms and labels.&lt;/P&gt;&lt;P&gt;I need to hide a field in the pop up based on the attributes of a separate field.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is our adopt a street program. The user wants the link to adopt a street hidden if the street is already adopted or pending adoption.&amp;nbsp; They also want the adopted group name field to be hidden if the street is available.&amp;nbsp;&amp;nbsp; I saw methods to hide a field based on conditions related to the same field but I did not find a method to hide a separate field based on another fields attributes.&lt;/P&gt;&lt;P&gt;&lt;A href="https://keizer.maps.arcgis.com/apps/instant/sidebar/index.html?appid=04aee73798314ce6b9a500de572addab" target="_self"&gt;Link to web app&lt;/A&gt; we are using the web app to embed the map in the adopt a street website.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I am looking for:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If ($feature, "street_adoption_status") != "Available"&amp;nbsp; than $feature["Link_Txt"] is not visible in pop up&lt;/P&gt;&lt;P&gt;If ($feature, "street_adoption_status") == "Adopted" than $feature["group_name"] is visible in pop-up&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp; Thank you for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 16:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179071#M46257</guid>
      <dc:creator>SRanseen</dc:creator>
      <dc:date>2022-06-01T16:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional field showing using arcade in map viewer popups</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179347#M46264</link>
      <description>&lt;P&gt;This isn't possible in the default fields element.&lt;/P&gt;&lt;P&gt;There's (at least) 2 options:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;write custom HTML in a text element (switch to HTML source) or an Arcade element, using the display style attribute to control whether you want to show a value or not:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;table&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Street&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;{street_map}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;tr style="display:{expression/expr0};"&amp;gt;&amp;lt;td&amp;gt;Group&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;{group_name}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;// expr0
// style="display: block;" shows the element
// style="display: none;" hides the element
if($feature.street_adoption_status == "Adopted") { return "block" }
return "none"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;define your fields in an Arcade element:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var trash_val = `${$feature.Total_Trasj} lb`
if(trash_val == " lb") {
    trash_val = null
}
var field_values = {
    "Street": $feature.street_map,
    "Street Adoption Status": $feature.street_adoption_status,
    "Street Length": `${Round($feature.Miles, 2)} miles`,
    "Total Trash": trash_val,
    "Adopt-A-Street Application": $feature.Link_Txt,
    "Adoption Group": $feature.group_name
}

var fields = [
    {"fieldName": "Street"},
    {"fieldName": "Street Adoption Status"},
    {"fieldName": "Street Length"},
    {"fieldName": "Total Trash"},
    ]
if($feature.street_adoption_status == "Available") {
    Push(fields, {"fieldName": "Adopt-A-Street Application"})
}
if($feature.street_adoption_status == "Adopted") {
    Push(fields, {"fieldName": "Adoption Group"})
}

return {
    type: 'fields',
    "fieldInfos": fields,
    "attributes" : field_values
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1654153883764.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42620i2EEEE75A4B1E0639/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1654153883764.png" alt="JohannesLindner_0-1654153883764.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="JohannesLindner_1-1654153918261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42621iB2602983ABC6A4CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1654153918261.png" alt="JohannesLindner_1-1654153918261.png" /&gt;&lt;/span&gt;&lt;/P&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, 02 Jun 2022 07:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179347#M46264</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-06-02T07:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional field showing using arcade in map viewer popups</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179490#M46269</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; I would not have figured that out with my current Arcade coding knowledge.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 15:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1179490#M46269</guid>
      <dc:creator>SRanseen</dc:creator>
      <dc:date>2022-06-02T15:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional field showing using arcade in map viewer popups</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1233250#M48963</link>
      <description>&lt;P&gt;Hi Johannes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The HTML opposite (First) to hide the fields from showing in the pop-up is this HTML code for the latest Map Viewer or for Map Viewer classic (or both?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 15:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1233250#M48963</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2022-11-18T15:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional field showing using arcade in map viewer popups</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1233523#M48976</link>
      <description>&lt;P&gt;I know it works with Map Viewer Classic, but it should also work with the new Map Viewer.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 18:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-field-showing-using-arcade-in-map/m-p/1233523#M48976</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-11-19T18:18:03Z</dc:date>
    </item>
  </channel>
</rss>

