<?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: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581256#M63448</link>
    <description>&lt;P&gt;Problem solved. I made an error, put in a "return" in line 6 that was not supposed to be there:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SveinungBertnesRheim_0-1738584096493.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124504i0818B21DE71164DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SveinungBertnesRheim_0-1738584096493.png" alt="SveinungBertnesRheim_0-1738584096493.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Var SurveyURL = "https://survey123.arcgis.com/share/e59bac1c82004ee49bc1dbfb321a0fd0?mode=edit&amp;amp;globalId=" + $feature.GlobalID
Var Feilmelding = $feature.Feilmelding=="OK"
Var Resultat = `&amp;lt;strong&amp;gt;&amp;lt;font size = "3" color="Blue"&amp;gt;Det er allerede meldt feil på dette lyset.&amp;lt;/strong&amp;gt;&amp;lt;/font&amp;gt;`

if (Feilmelding) {
  Resultat = `&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;font size = "5" color="Blue"&amp;gt;&amp;lt;a href="${SurveyURL}"&amp;gt;Meld inn feil på lyspunkt&amp;lt;/strong&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`
}

  return {
    type : 'text',
  text : Resultat
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code works as expected. The answer was in this &lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762" target="_self"&gt;post&lt;/A&gt;, just needed to change the code correct from attachments to an attribute value.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2025 12:06:30 GMT</pubDate>
    <dc:creator>SveinungBertnesRåheim</dc:creator>
    <dc:date>2025-02-03T12:06:30Z</dc:date>
    <item>
      <title>Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581164#M63444</link>
      <description>&lt;P&gt;I have a fairly simple issue. I have a public dataset for inspection of street lights. I have connected a survey123 schema to the feature set.&lt;/P&gt;&lt;P&gt;I want to show all street lights that are "OK" with a green symbol. I a malfunction is reported, the symbol changes to red.&lt;/P&gt;&lt;P&gt;I want the Popup to show a url to the survey123 when you click on a "green" symbol. If a malfunction is reported, you get a message stating something like "a malfunction is already reported".&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a field list in the popup, I can get this fairly easy with an iif-arcade expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;Var SurveyURL = "&lt;A href="https://survey123.arcgis.com/share/e59bac1c82004ee49bc1dbfb321a0fd0?mode=edit&amp;amp;globalId=" target="_blank" rel="noopener"&gt;https://survey123.arcgis.com/share/e59bac1c82004ee49bc1dbfb321a0fd0?mode=edit&amp;amp;globalId=&lt;/A&gt;" +$feature.GlobalID IIF($feature.Feilmelding=="OK", SurveyURL, "Det er alt meldt feil på dette lyset")&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;This look like this in the field list:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SveinungBertnesRheim_0-1738534364261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124486i66D06D2C33661F80/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SveinungBertnesRheim_0-1738534364261.png" alt="SveinungBertnesRheim_0-1738534364261.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;P&gt;I found this post, using arcade to show attachments when they exist, or another text when no attachments exist.&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I get it to work on data where a malfunction report is already done, but I cant get it work to show the popup.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here is my code: (the data is not shared with public, so it will not work.&lt;BR /&gt;Can anyone give a hint?&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&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;&lt;LI-CODE lang="javascript"&gt;Var SurveyURL = "https://survey123.arcgis.com/share/e59bac1c82004ee49bc1dbfb321a0fd0?mode=edit&amp;amp;globalId=" + $feature.GlobalID
Var Feilmelding = $feature.Feilmelding=="OK"
Var Resultat = `&amp;lt;strong&amp;gt;"Det er allerede meldt feil på dette lyset"&amp;lt;/strong&amp;gt;`

if (Feilmelding) {
return
  Resultat = `&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;a href="${SurveyURL}"&amp;gt;Meld inn feil på lyspunkt&amp;lt;/strong&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`
}


  return {
    type : 'text',
  text : Resultat
  }&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;&lt;P&gt;&amp;nbsp;&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>Mon, 03 Feb 2025 09:16:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581164#M63444</guid>
      <dc:creator>SveinungBertnesRåheim</dc:creator>
      <dc:date>2025-02-03T09:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581167#M63445</link>
      <description>&lt;P&gt;As an aside, it might be helpful if your code blocks were all using the code block functions on the boards.&amp;nbsp; There's no option for "Arcade", but if you use "JavaScript", it'll mostly get the syntax highlighting correct.&amp;nbsp; That button looks like &lt;STRONG&gt;&amp;lt;/&amp;gt;&lt;/STRONG&gt;, though you might have to hit the •••&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;button first, to see it.&lt;/P&gt;&lt;P&gt;Also, I might be losing the context a bit due to the language barrier, so bear with me.&amp;nbsp; If you're able to share any larger contexts as an image or map link, it&amp;nbsp;&lt;EM&gt;might&lt;/EM&gt; help.&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;My first thought is that the other question you linked might actually be a more direct solution.&amp;nbsp; You were initially able to get the link to show up in the right circumstances, but the issue was largely one of formatting.&amp;nbsp; Maybe instead of an Arcade expression, you should be inputting an Arcade&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;element&lt;/STRONG&gt;&lt;/EM&gt;, as discussed in the other post.&amp;nbsp; That would allow you to wrap your link in HTML formatting code to get the appearance you prefer.&lt;/P&gt;&lt;P&gt;Another option might be some clever/back-door use of filters &amp;amp; duplicate layers.&amp;nbsp; It doesn't look like you can directly add filters to the Pop-up, but you could sneakily duplicate the layer.&amp;nbsp; Copy A shows all symbols where the status is "OK", and has the pop-up configured for that situation.&amp;nbsp; Copy B shows all&amp;nbsp;&lt;EM&gt;other&lt;/EM&gt; symbols, and has the pop-up configured accordingly.&amp;nbsp; It'll be&amp;nbsp;&lt;EM&gt;messy&lt;/EM&gt; if anyone is looking at legends or content panes, but it'd likely work.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2025 22:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581167#M63445</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2025-02-02T22:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581201#M63446</link>
      <description>&lt;P&gt;I have tried to enter the code in a code block. I was only allowed to use one code block in a post.&lt;BR /&gt;Here are two pictures to explain my issue further.&lt;BR /&gt;Picture one shows the popup when an error is already reported. On top marked with red you can see the field list. This works, with its limitations. Below, marked with blue is the arcade-expression. This gives correct result for this situation. I get an explanation-text with my own html-formatting.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SveinungBertnesRheim_0-1738569076484.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124488i764040C00C41D148/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SveinungBertnesRheim_0-1738569076484.png" alt="SveinungBertnesRheim_0-1738569076484.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the other situation, no malfunction-report have been sent. Then the field list-view with the iif-arcade-expression works as expected. But without the desired formatting. The arcade-expression does not return anything. This is what I am asking for. And I would appreciate not to make two duplicate layers etc.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SveinungBertnesRheim_1-1738569288170.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124489i146454A992FE5EB3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SveinungBertnesRheim_1-1738569288170.png" alt="SveinungBertnesRheim_1-1738569288170.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 07:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581201#M63446</guid>
      <dc:creator>SveinungBertnesRåheim</dc:creator>
      <dc:date>2025-02-03T07:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581256#M63448</link>
      <description>&lt;P&gt;Problem solved. I made an error, put in a "return" in line 6 that was not supposed to be there:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SveinungBertnesRheim_0-1738584096493.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124504i0818B21DE71164DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SveinungBertnesRheim_0-1738584096493.png" alt="SveinungBertnesRheim_0-1738584096493.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Var SurveyURL = "https://survey123.arcgis.com/share/e59bac1c82004ee49bc1dbfb321a0fd0?mode=edit&amp;amp;globalId=" + $feature.GlobalID
Var Feilmelding = $feature.Feilmelding=="OK"
Var Resultat = `&amp;lt;strong&amp;gt;&amp;lt;font size = "3" color="Blue"&amp;gt;Det er allerede meldt feil på dette lyset.&amp;lt;/strong&amp;gt;&amp;lt;/font&amp;gt;`

if (Feilmelding) {
  Resultat = `&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;font size = "5" color="Blue"&amp;gt;&amp;lt;a href="${SurveyURL}"&amp;gt;Meld inn feil på lyspunkt&amp;lt;/strong&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`
}

  return {
    type : 'text',
  text : Resultat
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code works as expected. The answer was in this &lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762" target="_self"&gt;post&lt;/A&gt;, just needed to change the code correct from attachments to an attribute value.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 12:06:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581256#M63448</guid>
      <dc:creator>SveinungBertnesRåheim</dc:creator>
      <dc:date>2025-02-03T12:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581294#M63453</link>
      <description>&lt;P&gt;thanks for sharing!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 14:24:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581294#M63453</guid>
      <dc:creator>BertKraan</dc:creator>
      <dc:date>2025-02-03T14:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade and HTML in popup with IF-statement to show or not show dynamic URL</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581774#M63489</link>
      <description>&lt;P&gt;The forums not allowing you to insert more than one code block is certainly odd; I haven't encountered that.&amp;nbsp; Though I know if you have a code block selected and you hit that button again, it'll generally&amp;nbsp;&lt;EM&gt;edit&lt;/EM&gt; the selected one, rather than inserting a new one.&amp;nbsp; That, or we could always blame the standard cosmic ray bitflip/a wizard did it.&lt;/P&gt;&lt;P&gt;Glad to hear that you solved the original problem in the thread!&amp;nbsp; It really does seem always the simplest "D'oh" moments that trip us up, isn't it?&amp;nbsp; I've been there many times.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 15:31:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-and-html-in-popup-with-if-statement-to/m-p/1581774#M63489</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2025-02-04T15:31:41Z</dc:date>
    </item>
  </channel>
</rss>

