<?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 Adding multiple images using Arcade in a popup in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1058650#M40097</link>
    <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to display the sustainable development goals (SDG's) in a popup based on an input in the feature. I have written the code in Arcade which works if one SDG is mentioned in the feature. However, problem arises if one input has multiple SDG's (i.e. '1, 4, 5'). A function cannot return multiple links for an image. I was curious if there is a workaround for this?&lt;/P&gt;&lt;P&gt;See my code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// input of data i.e. '1, 4, 12'
var data_atr = $feature["SDG_s"]
var list = Split(data_atr, ' ')
// deleting space
var result = ''
for (var i in list) {
    if (!IsEmpty(list[i])){   
        if (result == ''){
            result = list[i]
        } else {
            result += list[i]
        }
    }
}
// splitting of numbers
var sdgs = split(result, ',')

var url = ''
var baseurl = 'https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-'
var extension = '.png?resize=200%2C200&amp;amp;ssl=1'

// making of counter
for (i = 1; i &amp;lt;= 17; i++) {
    // iterate over sdgs
    for (var j in sdgs){
        // adding '0' in the link
        if (i &amp;lt; 10) {
            if (number(sdgs[j]) == i) {
            url = baseurl + '0' + i + extension
            console(url)
            return url
           }
        } else if (i &amp;gt; 10) {
            if (number(sdgs[j]) == i) {
            url = baseurl + i + extension
            console(url)
            return url
           }
        }
    }  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have wondered if you could index a expression so you could add the images manually.&lt;/P&gt;&lt;P&gt;Could somebody steer me in the right direction?&lt;/P&gt;</description>
    <pubDate>Mon, 17 May 2021 18:10:05 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-05-17T18:10:05Z</dc:date>
    <item>
      <title>Adding multiple images using Arcade in a popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1058650#M40097</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to display the sustainable development goals (SDG's) in a popup based on an input in the feature. I have written the code in Arcade which works if one SDG is mentioned in the feature. However, problem arises if one input has multiple SDG's (i.e. '1, 4, 5'). A function cannot return multiple links for an image. I was curious if there is a workaround for this?&lt;/P&gt;&lt;P&gt;See my code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// input of data i.e. '1, 4, 12'
var data_atr = $feature["SDG_s"]
var list = Split(data_atr, ' ')
// deleting space
var result = ''
for (var i in list) {
    if (!IsEmpty(list[i])){   
        if (result == ''){
            result = list[i]
        } else {
            result += list[i]
        }
    }
}
// splitting of numbers
var sdgs = split(result, ',')

var url = ''
var baseurl = 'https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-'
var extension = '.png?resize=200%2C200&amp;amp;ssl=1'

// making of counter
for (i = 1; i &amp;lt;= 17; i++) {
    // iterate over sdgs
    for (var j in sdgs){
        // adding '0' in the link
        if (i &amp;lt; 10) {
            if (number(sdgs[j]) == i) {
            url = baseurl + '0' + i + extension
            console(url)
            return url
           }
        } else if (i &amp;gt; 10) {
            if (number(sdgs[j]) == i) {
            url = baseurl + i + extension
            console(url)
            return url
           }
        }
    }  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have wondered if you could index a expression so you could add the images manually.&lt;/P&gt;&lt;P&gt;Could somebody steer me in the right direction?&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 18:10:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1058650#M40097</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-17T18:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple images using Arcade in a popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1059523#M40162</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this was a ArcGIS Pro question, the answer would be simple. You can use Arcade and generate the HTML and return the images as show below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1621443029453.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13647i6D3BE460550A5552/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1621443029453.png" alt="XanderBakker_0-1621443029453.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You were really close, but keep in mind that using a return statement inside a loop will return the first item and exits the loop.&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcGIS Online does not allow the return of HTML from an Arcade expression. You will need an expression for each image and return it inside an HTML formatted pop-up and probably need another expression to hide an image when you don't have that number in the list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have done some HTML formatting with conditional images described here:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/create-pop-ups-in-arcgis-online-with-conditional-images-using/ta-p/916518" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/create-pop-ups-in-arcgis-online-with-conditional-images-using/ta-p/916518&lt;/A&gt;&amp;nbsp;but maybe including all the 17 images and hide them depending on the values supplied would be a better way. You can find an example here:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/conditional-field-display-with-arcade-in-pop-ups-revisited/ta-p/920869" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/conditional-field-display-with-arcade-in-pop-ups-revisited/ta-p/920869&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will do a quick test first to share some more details later on.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 16:58:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1059523#M40162</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-19T16:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple images using Arcade in a popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1059610#M40169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just did the test and it will work in ArcGIS Online:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1621451394008.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13672iE3BDFC2FE23F714D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1621451394008.png" alt="XanderBakker_0-1621451394008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I configured it in the old Map Viewer but it displays better in the new map viewer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you need to do is create 1 Arcade expression for each SDG with the following content:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var txt = Replace($feature["SDGs"], " ", "");
var lst = Split(txt, ",");
if (IndexOf(lst, "#") &amp;gt; -1) {
    return "block";
} else {
    return "none";
}&lt;/LI-CODE&gt;&lt;P&gt;Change the "#" on line 3 for the SDG number the images applies to (no leading zero). Configure to use a customized HTML pop-up:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_1-1621451539661.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13673i5C51792CDB4680B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_1-1621451539661.png" alt="XanderBakker_1-1621451539661.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Change to HTML mode:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_2-1621451771951.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13674i4805D7A5DCD6C016/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_2-1621451771951.png" alt="XanderBakker_2-1621451771951.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Paste the following HTML:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SDGs {SDGs}&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;img alt="SDG 01" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-01.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr0}" /&amp;gt;

&amp;lt;img alt="SDG 02" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-02.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr1}" /&amp;gt;

&amp;lt;img alt="SDG 03" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-03.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr2}" /&amp;gt;

&amp;lt;img alt="SDG 04" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-04.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr3}" /&amp;gt;

&amp;lt;img alt="SDG 05" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-05.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr4}" /&amp;gt;

&amp;lt;img alt="SDG 06" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-06.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr5}" /&amp;gt;

&amp;lt;img alt="SDG 07" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-07.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr6}" /&amp;gt;

&amp;lt;img alt="SDG 08" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-08.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr7}" /&amp;gt;

&amp;lt;img alt="SDG 09" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-09.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr8}" /&amp;gt;

&amp;lt;img alt="SDG 10" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-10.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr9}" /&amp;gt;

&amp;lt;img alt="SDG 11" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-11.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr10}" /&amp;gt;

&amp;lt;img alt="SDG 12" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-12.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr11}" /&amp;gt;

&amp;lt;img alt="SDG 13" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-13.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr12}" /&amp;gt;

&amp;lt;img alt="SDG 14" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-14.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr13}" /&amp;gt;

&amp;lt;img alt="SDG 15" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-15.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr14}" /&amp;gt;

&amp;lt;img alt="SDG 16" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-16.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr15}" /&amp;gt;

&amp;lt;img alt="SDG 17" src="https://i1.wp.com/www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-Goal-17.png?resize=100%2C100&amp;amp;amp;ssl=1" style="display:{expression/expr16}" /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 19:17:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1059610#M40169</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-19T19:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple images using Arcade in a popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1060091#M40190</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the idea and code! Very smart to use HTML formatting on the image to show or hide it. I was not sure if it would be possible to use this method because the&amp;nbsp;&lt;EM&gt;HTML Mode&amp;nbsp;&lt;/EM&gt;in Map VIewer is not available yet. I thought it might not be supported yet. So just a back and forth between the old and new version!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&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>Thu, 20 May 2021 18:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1060091#M40190</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-20T18:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple images using Arcade in a popup</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1060143#M40192</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Indeed the HTML configuration of the pop-up is not yet implemented in the Map Viewer and the Classic Map Viewer should be used for this. It will show up correctly in the new Map Viewer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 19:23:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/adding-multiple-images-using-arcade-in-a-popup/m-p/1060143#M40192</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-20T19:23:00Z</dc:date>
    </item>
  </channel>
</rss>

