<?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: How can I return all individual array items as separate lines of text? in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1104357#M1042</link>
    <description>&lt;P&gt;Thank you! I tried it with 'return concatenate' and that still only gave one link so I took out return and it gave all of the links. I knew I was close, I was just burnt-out looking at it so thanks again for the help!&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 11:04:15 GMT</pubDate>
    <dc:creator>ColtonPhillips</dc:creator>
    <dc:date>2021-10-04T11:04:15Z</dc:date>
    <item>
      <title>How can I return all individual array items as separate lines of text?</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1103204#M1040</link>
      <description>&lt;P class=""&gt;Hello,&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;I'm working in arcade and I am trying to write an expression that gives me the value of a field and convert it to text.&lt;/P&gt;&lt;P class=""&gt;What I did was create an Array that stores all non-null values in to the array. From there, I want the array to return the individual text value for each item in the array. For example....&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;['orange', 'apple', 'banana']

&amp;gt;orange

&amp;gt;apple

&amp;gt;banana&lt;/LI-CODE&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;What I am getting though is just a return of the first item in the array with the code below. Is my For loop wrong?&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var i = 0;

var links = [];

function addValue(feat){

if(!IsEmpty(feat)) {

links[i++] = feat;}

};

addValue($feature["PDF_LINK_01"]);

addValue($feature["PDF_LINK_02"]);

addValue($feature["PDF_LINK_03"]);

addValue($feature["PDF_LINK_04"]);

addValue($feature["PDF_LINK_05"]);

addValue($feature["PDF_LINK_06"]);

addValue($feature["PDF_LINK_07"]);

addValue($feature["PDF_LINK_08"]);

addValue($feature["PDF_LINK_09"]);

addValue($feature["PDF_LINK_10"]);

addValue($feature["PDF_LINK_11"]);

addValue($feature["PDF_LINK_12"]);

addValue($feature["PDF_LINK_13"]);

addValue($feature["PDF_LINK_14"]);

addValue($feature["PDF_LINK_15"]);

addValue($feature["PDF_LINK_16"]);

addValue($feature["PDF_LINK_17"]);

addValue($feature["PDF_LINK_18"]);

addValue($feature["PDF_LINK_19"]);

addValue($feature["PDF_LINK_20"]);



for(var k in links){

return links[k]

};&lt;/LI-CODE&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;The above only returns "PDF_LINK_01".&lt;/P&gt;&lt;P class=""&gt;If I take out the For loop, it returns ['PDF_LINK_01', 'PDF_LINK_02', 'PDF_LINK_03', 'PDF_LINK_04']&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Any help is appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 18:21:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1103204#M1040</guid>
      <dc:creator>ColtonPhillips</dc:creator>
      <dc:date>2021-09-29T18:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can I return all individual array items as separate lines of text?</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1103225#M1041</link>
      <description>&lt;P data-unlink="true"&gt;I'm assuming this is &lt;A href="https://developers.arcgis.com/arcade/guide/logic/#for-loops" target="_self"&gt;Arcade&lt;/A&gt;? The &lt;A href="https://developers.arcgis.com/arcade/#returning-values-from-your-script" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;return&lt;/FONT&gt;&lt;/A&gt; statement will exit the function immediately, which is why it only returns the first value. You would need to build a multiline&amp;nbsp;string within your for loop and then &lt;FONT face="courier new,courier"&gt;return&lt;/FONT&gt; it after the loop has finished.&lt;/P&gt;&lt;P&gt;However, you can use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate" target="_self"&gt;Concatenate()&lt;/A&gt; function to put everything together with a &lt;A href="https://developers.arcgis.com/arcade/function-reference/constants/#textformattingnewline" target="_self"&gt;NewLine&lt;/A&gt;&amp;nbsp;and you don't even need a for loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Concatenate(links, TextFormatting.NewLine)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 19:16:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1103225#M1041</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-09-29T19:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I return all individual array items as separate lines of text?</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1104357#M1042</link>
      <description>&lt;P&gt;Thank you! I tried it with 'return concatenate' and that still only gave one link so I took out return and it gave all of the links. I knew I was close, I was just burnt-out looking at it so thanks again for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 11:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/how-can-i-return-all-individual-array-items-as/m-p/1104357#M1042</guid>
      <dc:creator>ColtonPhillips</dc:creator>
      <dc:date>2021-10-04T11:04:15Z</dc:date>
    </item>
  </channel>
</rss>

