<?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: AGOL Pop-Ups Text Content Table Formatting in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515583#M60686</link>
    <description>&lt;P&gt;Thanks Josh.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2024 15:55:31 GMT</pubDate>
    <dc:creator>Christopher_Spadi</dc:creator>
    <dc:date>2024-08-06T15:55:31Z</dc:date>
    <item>
      <title>AGOL Pop-Ups Text Content Table Formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515245#M60659</link>
      <description>&lt;P&gt;Greetings,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In map viewer, I am using the pop-ups, Text (content), to create a table from a map service table. I am close to what I need but can't get specific fields to highlight or appear bold/different color in the pop up when the condition is meet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arcade expression (one for each field):&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test1ExceedsD1 = $feature.Test1Exceed_D1;
var test1ResultD1 = $feature.Test1Result_D1;
if (test1ExceedsD1 == "Y") {
    return "&amp;lt;span style='font-weight:bold; color:red;'&amp;gt;" + test1ResultD1 + "&amp;lt;/span&amp;gt;";
} else {
    return test1ResultD1;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then for the html source in text:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;figure class="table"&amp;gt;
    &amp;lt;table&amp;gt;
        &amp;lt;tbody&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;td style="background-color:hsl(0, 0%, 90%);border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    ft(bgs)
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="background-color:hsl(0, 0%, 90%);border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    PCE&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="background-color:hsl(0, 0%, 90%);border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    TCE&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="background-color:hsl(0, 0%, 90%);border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    VC&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="background-color:hsl(0, 0%, 90%);border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    Benz&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {Depth1}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr0}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr1}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr2}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr3}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {Depth2}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr4}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr5}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr6}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
                &amp;lt;td style="border:1px solid hsl(0, 0%, 30%);text-align:right;"&amp;gt;
                    {expression/expr7}&amp;amp;nbsp;
                &amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        &amp;lt;/tbody&amp;gt;
    &amp;lt;/table&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Result (1st row is null):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Christopher_Spadi_1-1722902071042.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/111667i83162F8F167B2477/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Christopher_Spadi_1-1722902071042.png" alt="Christopher_Spadi_1-1722902071042.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Christopher_Spadi_1-1722902071042.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My ideal situation would be to highlight a cell yellow if it meets the condition instead of making the value bold, but I can't even seem to get that to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 23:55:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515245#M60659</guid>
      <dc:creator>Christopher_Spadi</dc:creator>
      <dc:date>2024-08-05T23:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Pop-Ups Text Content Table Formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515259#M60661</link>
      <description>&lt;P&gt;Try to use an Arcade popop element. Instead of defining a ton of variables separately, you could write them all in a single expression and build the HTML that way. An Arcade popup element is capable of dynamic HTML, where a text element is not.&lt;/P&gt;&lt;P&gt;Also, certain styles will be inherited by all child elements, so you can set things like header background and font alignment on the table as a whole. Saves a lot of text and makes your HTML more readable.&lt;/P&gt;&lt;P&gt;Since you just need the "exceeds" field to control the background color, we can insert that into each row where appropriate. Using a backtick string, we can use template literals, inserting the values into the exact spot we need them.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// conditional style text per field
var t1d1 = Iif(
  $feature.test1ExceedsD1 == 'Y',
  'background-color:red; font-weight:bold;',
  'background-color:white;'
)

var t2d1 = Iif(…) // and so on

var html = `&amp;lt;table style="border:1px solid hsl(0, 0%, 30%); border-collapse:collapse; text-align:right;" cellpadding=3&amp;gt;
  &amp;lt;tbody&amp;gt;
    &amp;lt;tr style="background-color:hsl(0, 0%, 90%);"&amp;gt;
      &amp;lt;td&amp;gt;ft(bgs)&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;PCE&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;TCE&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;VC&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;Benz&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;{Depth1}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t1d1}"&amp;gt;{$feature.test1ResultD1}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t2d1}"&amp;gt;{$feature.test2ResultD1}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t3d1}"&amp;gt;{$feature.test3ResultD1}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t4d1}"&amp;gt;{$feature.test4ResultD1}&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;{Depth2}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t1d2}"&amp;gt;{$feature.test1ResultD2}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t2d2}"&amp;gt;{$feature.test2ResultD2}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t3d2}"&amp;gt;{$feature.test3ResultD2}&amp;lt;/td&amp;gt;
      &amp;lt;td style="${t4d2}"&amp;gt;{$feature.test4ResultD2}&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/tbody&amp;gt;
&amp;lt;/table&amp;gt;`

return {
  type: 'text',
  text: html
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just using random numbers to assign the background color, but whenever the random number is greater than 0.5, it goes red.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1722910820113.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/111668i5D3CB2DFE3A8835E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1722910820113.png" alt="jcarlson_0-1722910820113.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_0-1722910820113.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1722910882615.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/111669i0E8A865ECF81EF81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1722910882615.png" alt="jcarlson_1-1722910882615.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;jcarlson_1-1722910882615.png&lt;/span&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>Tue, 06 Aug 2024 02:21:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515259#M60661</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-08-06T02:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Pop-Ups Text Content Table Formatting</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515583#M60686</link>
      <description>&lt;P&gt;Thanks Josh.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 15:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-pop-ups-text-content-table-formatting/m-p/1515583#M60686</guid>
      <dc:creator>Christopher_Spadi</dc:creator>
      <dc:date>2024-08-06T15:55:31Z</dc:date>
    </item>
  </channel>
</rss>

