<?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 to return HTML text in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1318803#M53925</link>
    <description>&lt;P&gt;If I would like to call just the text (result) variable, what is the syntax? I tried expression/expr0 and it returned both type and text value.&amp;nbsp; Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 15 Aug 2023 17:21:20 GMT</pubDate>
    <dc:creator>loum</dc:creator>
    <dc:date>2023-08-15T17:21:20Z</dc:date>
    <item>
      <title>Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762</link>
      <description>&lt;P&gt;I'm trying to get a pop-up to return a photo from a URL (with a link) if the Attachment_URL field is not empty, and a text string if it is empty. I'm using the following code. It returns "No photo available" when appropriate, but instead a photo, it returns a table with the key:value pairs as seen in the photo. How do I get it to return the literal text string and not a table?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var attachment = $feature.Attachment_URL

if (isEmpty(attachment)){
  return "No photo available"
} else {
  return {
    type : "text",
    text : `&amp;lt;p&amp;gt;Click the photo to open full size in new tab&amp;lt;/p&amp;gt;
    &amp;lt;p style="text-align:center;"&amp;gt;&amp;lt;a href="${attachment}?size=full"&amp;gt;
    &amp;lt;img class="image_resized" style="width:100%;" src="${attachment}?size=lg" alt="Photo of ${$feature.Common_Name}"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`
  }
}&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="swhitcombMCC_0-1691267416496.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/77401i0A15267B72D03BFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="swhitcombMCC_0-1691267416496.png" alt="swhitcombMCC_0-1691267416496.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2023 20:33:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315823#M53762</guid>
      <dc:creator>swhitcombMCC</dc:creator>
      <dc:date>2023-08-05T20:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315903#M53764</link>
      <description>&lt;P&gt;An Arcade &lt;STRONG&gt;expression&lt;/STRONG&gt; can't interpret HTML. What you want is an Arcade &lt;STRONG&gt;element&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1691386327280.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/77416i5E250A61532E194D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1691386327280.png" alt="JohannesLindner_0-1691386327280.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An Arcade element returns a dictionary (which your code does) and can interpret that in different ways, depending on the "type" keyword (see &lt;A href="https://developers.arcgis.com/web-map-specification/objects/popupElement/" target="_blank" rel="noopener"&gt;here&lt;/A&gt; for different possible types).&lt;/P&gt;&lt;P&gt;We just have to change your code a little bit so that it also returns a dictionary when the url is empty:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var attachment = $feature.Attachment_URL
var result = "No photo available"

if (!isEmpty(attachment)){
  result = `&amp;lt;p&amp;gt;Click the photo to open full size in new tab&amp;lt;/p&amp;gt;
    &amp;lt;p style="text-align:center;"&amp;gt;&amp;lt;a href="${attachment}?size=full"&amp;gt;
    &amp;lt;img class="image_resized" style="width:100%;" src="${attachment}?size=lg" alt="Photo of ${$feature.Common_Name}"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;`
}

return {
  type : "text",
  text : result
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Aug 2023 05:37:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1315903#M53764</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-07T05:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1318803#M53925</link>
      <description>&lt;P&gt;If I would like to call just the text (result) variable, what is the syntax? I tried expression/expr0 and it returned both type and text value.&amp;nbsp; Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 17:21:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1318803#M53925</guid>
      <dc:creator>loum</dc:creator>
      <dc:date>2023-08-15T17:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1318910#M53934</link>
      <description>&lt;P&gt;Just do this in line 10:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be aware that the code in my answer is for an Arcade element, which needs to return the dictionary. In Arcade expressions, you can return a simple value, but they are limited in what they can display (eg they can't interpret HTML, which was the point of this question).&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 21:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1318910#M53934</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-15T21:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1319087#M53946</link>
      <description>&lt;P&gt;Thank you for your response and information. You are right, they have limitation to display arcade value in TEXT attribute. My task was to display multi values from multi layers through intersect in an uneven table rows. I ended up create the table in TEXT attribute first to make sure it displays and works fine before move it to ARCADE attribute which I can consume multi values from multiple layers. Thanks again for the insight&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 12:37:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1319087#M53946</guid>
      <dc:creator>loum</dc:creator>
      <dc:date>2023-08-16T12:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1327036#M54475</link>
      <description>&lt;P&gt;This is huge!&amp;nbsp; Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;, you honestly might have just saved me from going with a full JavaScript application.&amp;nbsp; Which has been built, but maintenance if I change departments would be a nightmare.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 23:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1327036#M54475</guid>
      <dc:creator>RyanBohan</dc:creator>
      <dc:date>2023-09-08T23:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333024#M54795</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new with configuring Smart Forms, but I am trying to create a calculated expression for an "Inspector Name" field for an asset inspection form I created. I would like to have the inspector's name automatically populate, where it basically pulls from the ArcGIS Account name or their email possiblily.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StaciMcLaughlin_0-1695837320752.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81794i41BCA6E9B75BC1A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StaciMcLaughlin_0-1695837320752.png" alt="StaciMcLaughlin_0-1695837320752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Luckily I was able to figure out the expression to automatically pull in the Inspection date of when the form was complete with the time, but now I need to determine how I can automatically pull in the user name.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StaciMcLaughlin_2-1695837935781.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81796i23705A1DF2AC6BC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StaciMcLaughlin_2-1695837935781.png" alt="StaciMcLaughlin_2-1695837935781.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has any insight or expressions they could share I would appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&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>Wed, 27 Sep 2023 18:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333024#M54795</guid>
      <dc:creator>StaciMcLaughlin</dc:creator>
      <dc:date>2023-09-27T18:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333104#M54797</link>
      <description>&lt;P&gt;I suggest asking this as a new question, as it doesn't really have anything to do with this question. Plus, your new question will appear on the community feed and attract far more attention.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 20:19:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333104#M54797</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-09-27T20:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333105#M54798</link>
      <description>##- Thank you! -##</description>
      <pubDate>Wed, 27 Sep 2023 20:22:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1333105#M54798</guid>
      <dc:creator>StaciMcLaughlin</dc:creator>
      <dc:date>2023-09-27T20:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to return HTML text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1541084#M61618</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I know this is an old post, but this is no longer working for me and wondered if you had any ideas. I know there have been a few updates to AGOL since this post. In the above example if the attachment is not empty it returns, "&amp;nbsp;&amp;lt;p&amp;gt;Click the photo to open full size in new tab&amp;lt;/p&amp;gt;" Now the popup views the HTML tags as text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 21:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-return-html-text/m-p/1541084#M61618</guid>
      <dc:creator>JerrySneary</dc:creator>
      <dc:date>2024-09-20T21:46:55Z</dc:date>
    </item>
  </channel>
</rss>

