<?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: Getting Text formatting (Arcade &amp;amp; HTML) to work in Field Maps Popup in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1494173#M59752</link>
    <description>&lt;P&gt;Still no joy on this one. Anyone out there got any insights on how to format text strings in Field Maps AND WebApps?&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 05:20:21 GMT</pubDate>
    <dc:creator>LindsayRaabe_FPCWA</dc:creator>
    <dc:date>2024-06-18T05:20:21Z</dc:date>
    <item>
      <title>Getting Text formatting (Arcade &amp; HTML) to work in Field Maps Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1294869#M52535</link>
      <description>&lt;P&gt;I've written an arcade script which pulls dates from a table using a lookup for a selected feature in the map. The popup returns the results as a list of Fields, with some text green or red depending on if the data has "expired" (date in the past or future).&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the text formatting on lines 28-32. What I want to know is do I need to change something or do it differently to get this working in Field Maps? Currently it works great in an Experience Builder WebApp, but not Field Maps (screenshots below).&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;LI-CODE lang="java"&gt;// Built from this reference page: https://learn.arcgis.com/en/projects/access-attributes-from-another-layer-with-arcade/
// Get OpCode from layer
var OpCode = $feature.Ops_Code

// Get required DAS attributes as a FeatureSet
var DASFSet = FeatureSetByName($map, "Disturbance Approvals Report",
['Plantation', 'DBCA_Tenure', 'DAS_Approval_Number', 'DAS_Approval_Date',	
'DAS_Expiry_Date', 'DAS_CM_Proposal_Doc_URI', 'DAS_CM_Approval_Doc_URI'], false)

// Filter DAS FeatureSet to only return values for the relevant OpCode
var filteredDASFSet = Filter(DASFSet, 'Ops_Code = @OpCode')
// Select the first OpCode in the FeatureSet
//   This essentially changes the data type from FeatureSet to a feature because in this case, there is only one feature in each FeatureSet
var filteredDAS = First(filteredDASFSet)

// Calculate values to return in output string
var URLStart = 'https://cm.fpc.wa.gov.au/HPEContentManager/HPRMServiceApi/Record/'
var URLFinish = '/File/Document'

var DBCA_Tenure =  IIf(filteredDAS.DBCA_Tenure == "Yes", "Yes - DAS Required", "No - DAS not required")
var DAS_Approval_Number = IIf(filteredDAS.DBCA_Tenure == "Yes", filteredDAS.DAS_Approval_Number,"")
var DAS_Approval_Date = IIf(filteredDAS.DBCA_Tenure == "Yes", Text(filteredDAS.DAS_Approval_Date, 'DD/MM/Y'),"")
var DAS_CM_Proposal_URL = IIf(filteredDAS.DBCA_Tenure == "Yes", IIf(isempty(filteredDAS.DAS_CM_Proposal_Doc_URI) == True, "", URLStart + filteredDAS.DAS_CM_Proposal_Doc_URI + URLFinish),"")
var DAS_CM_Approval_URL = IIf(filteredDAS.DBCA_Tenure == "Yes", IIf(isempty(filteredDAS.DAS_CM_Approval_Doc_URI) == True, "", URLStart + filteredDAS.DAS_CM_Approval_Doc_URI + URLFinish),"")

// Check Expiry date and format accordingly

var ExpiredFormat = [{"Status": Text(filteredDAS.DAS_Expiry_Date, 'DD/MM/Y') + " (Expired)","color":"red"}, {"Status":Text(filteredDAS.DAS_Expiry_Date, 'DD/MM/Y') + " (Current)","color":"green"},]

var findExpFormat = When(filteredDAS.DAS_Expiry_Date &amp;lt; Now(),ExpiredFormat[0],ExpiredFormat[1])

var DAS_Expiry_Date_Formatted = IIf(isempty(filteredDAS.DAS_Expiry_Date) == True, "", IIf(filteredDAS.DBCA_Tenure == "Yes", `&amp;lt;span style="color:${findExpFormat.color};"&amp;gt;${findExpFormat.Status} &amp;lt;/span&amp;gt;`,""))

// Output dictionary as fields to display in the pop-up

return {
    type: 'fields',
    title: 'DAS Details',
    //description : '',
    fieldInfos:  [{
          fieldName: "DBCA Tenure"  // fieldName should match the key in the attributes dictionary
        },
        {
          fieldName: "DAS Approval #"  // fieldName should match the key in the attributes dictionary
        },
        {
          fieldName: "DAS Approval Date"  // fieldName should match the key in the attributes dictionary
        },
        {
          fieldName: "DAS Expiry Date"  // fieldName should match the key in the attributes dictionary
        },
        {
          fieldName: "Proposal"  // fieldName should match the key in the attributes dictionary
        },
        {
          fieldName: "Approval"  // fieldName should match the key in the attributes dictionary
        }],
    attributes : {"DBCA Tenure" : DBCA_Tenure, "DAS Approval #" : DAS_Approval_Number, "DAS Approval Date" : DAS_Approval_Date, "DAS Expiry Date" : DAS_Expiry_Date_Formatted, "Proposal" : DAS_CM_Proposal_URL, "Approval" : DAS_CM_Approval_URL}  // replace this dictionary with your own key-value pairs
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&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="LindsayRaabe_FPCWA_2-1718687868383.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107274i1489A83B0277EC49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_2-1718687868383.png" alt="LindsayRaabe_FPCWA_2-1718687868383.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="LindsayRaabe_FPCWA_2-1685603278394.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72139iC70FCC58754F7448/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LindsayRaabe_FPCWA_2-1685603278394.png" alt="LindsayRaabe_FPCWA_2-1685603278394.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>Tue, 18 Jun 2024 05:19:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1294869#M52535</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2024-06-18T05:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Text formatting (Arcade &amp; HTML) to work in Field Maps Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1494173#M59752</link>
      <description>&lt;P&gt;Still no joy on this one. Anyone out there got any insights on how to format text strings in Field Maps AND WebApps?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 05:20:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1494173#M59752</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2024-06-18T05:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Text formatting (Arcade &amp; HTML) to work in Field Maps Popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1598170#M64103</link>
      <description>&lt;P&gt;Might have to return text instead?&amp;nbsp; Not sure how that looks in Experience Builder though. (Edit - Seems to work there, as well.)&amp;nbsp; Unfortunately, there are a lot of different contexts that show a lot of different things differently.&amp;nbsp; (Apologies for how vague that part is.)&amp;nbsp; I've found that you will see differences in pop-ups in Web Map Viewer, Field Maps, and elsewhere - and how you return or display those pop-ups will also yield differences.&amp;nbsp; (As in, you can add a text pop-up, and you add an expression to it you calculated, and that might show different results than adding an Arcade pop-up with the same expression - and also info elements in Field Maps may display differently - where you can also calculate an expression elsewhere and bring that into the info element.)&lt;/P&gt;&lt;P&gt;I am &lt;EM&gt;assuming&lt;/EM&gt;&amp;nbsp;you should be able to get your data similar to how you are above, but then build out your HTML when returning it as text.&amp;nbsp; I believe when you return text in a pop-up that is HTML formatted it should appear as HTML&amp;nbsp;&lt;EM&gt;in most places, but not&lt;/EM&gt;&lt;EM&gt; all places -&amp;nbsp;&lt;/EM&gt;I wouldn't ever guarantee the same behavior everywhere.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return { 
 	type : 'text', 
 	text : variable //this property supports html tags 
 }&lt;/LI-CODE&gt;&lt;P&gt;Not sure if this was helpful or not, but I might be able to assist further if I knew where you were building this out.&lt;/P&gt;&lt;P&gt;Edit - If you add an Arcade pop-up in Web Map Viewer - you will end up with the return value I posted above.&amp;nbsp; I checked that the pop-up formats HTML in Field Maps and in Experience Builder - but oddly enough, it will not format it in the pop-up in Web Map Viewer itself. Might be a way to discern the context and return different types/values, but for Field Maps and Experience Builder - this might work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MitchellGrafstein_0-1742586153772.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128483iBA6F2F20DBEFA4B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MitchellGrafstein_0-1742586153772.png" alt="MitchellGrafstein_0-1742586153772.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 19:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/getting-text-formatting-arcade-amp-html-to-work-in/m-p/1598170#M64103</guid>
      <dc:creator>MitchellGrafstein</dc:creator>
      <dc:date>2025-03-21T19:45:07Z</dc:date>
    </item>
  </channel>
</rss>

