<?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 No values are retrieved from a related table (for loop) in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300143#M972</link>
    <description>&lt;P&gt;Hello world,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could use your help with the following issue:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;I'm trying to retrieve (string, text) values from a related table and present them in a PopUp&lt;EM&gt; (Enterprise 10.9.1, webmap).&lt;/EM&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I think the issue is a combination of line 2, 10&amp;nbsp; and 17. Since the code is working on a basic number field. Who can help me out?&amp;nbsp; (Thank you in advanced!)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//Get information from the related table
var relatedtabel = FeatureSetByRelationshipName($feature,"XXXXXX.NAMETabel",["OL_FIRSTNAME","OL_LASTNAME","OL_DATE"]);
var cnt = Count(relatedtabel);

if (cnt &amp;gt; 0) {
console("Found value")
var num = 0;   //not sure if this is needed. 
var result = "";
var listvalues = [];
var info = (relatedtabel);

    for (var num=0; num &amp;lt; cnt; num++) {
        console("ascending number: [" + num + "]")
        console("total numbers found: [" + cnt + "]")
        var relatedinfo = "";
        
        relatedinfo = Text(info.OL_LASTNAME + "  |  " + Month(info.OL_DATE) + "-" + Year(info.OL_DATE)) + TextFormatting.NewLine;
        result += insert(listvalues,num,relatedinfo);
    }
    return Concatenate([listvalues]);  
}

// if there are no related data at all 

else {
console("no value found")
    var nodata = "";
    nodata = Text("Geen informatie");
    return nodata
}&lt;/LI-CODE&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>Fri, 16 Jun 2023 09:15:32 GMT</pubDate>
    <dc:creator>Manniej</dc:creator>
    <dc:date>2023-06-16T09:15:32Z</dc:date>
    <item>
      <title>No values are retrieved from a related table (for loop)</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300143#M972</link>
      <description>&lt;P&gt;Hello world,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could use your help with the following issue:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;I'm trying to retrieve (string, text) values from a related table and present them in a PopUp&lt;EM&gt; (Enterprise 10.9.1, webmap).&lt;/EM&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I think the issue is a combination of line 2, 10&amp;nbsp; and 17. Since the code is working on a basic number field. Who can help me out?&amp;nbsp; (Thank you in advanced!)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//Get information from the related table
var relatedtabel = FeatureSetByRelationshipName($feature,"XXXXXX.NAMETabel",["OL_FIRSTNAME","OL_LASTNAME","OL_DATE"]);
var cnt = Count(relatedtabel);

if (cnt &amp;gt; 0) {
console("Found value")
var num = 0;   //not sure if this is needed. 
var result = "";
var listvalues = [];
var info = (relatedtabel);

    for (var num=0; num &amp;lt; cnt; num++) {
        console("ascending number: [" + num + "]")
        console("total numbers found: [" + cnt + "]")
        var relatedinfo = "";
        
        relatedinfo = Text(info.OL_LASTNAME + "  |  " + Month(info.OL_DATE) + "-" + Year(info.OL_DATE)) + TextFormatting.NewLine;
        result += insert(listvalues,num,relatedinfo);
    }
    return Concatenate([listvalues]);  
}

// if there are no related data at all 

else {
console("no value found")
    var nodata = "";
    nodata = Text("Geen informatie");
    return nodata
}&lt;/LI-CODE&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>Fri, 16 Jun 2023 09:15:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300143#M972</guid>
      <dc:creator>Manniej</dc:creator>
      <dc:date>2023-06-16T09:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: No values are retrieved from a related table (for loop)</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300168#M973</link>
      <description>&lt;P&gt;Try this.&amp;nbsp; You do not want to call count on a FeatureSet, it is better to loop over it and handle when there is nothing to loop over&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Get information from the related table
var relatedtabel = FeatureSetByRelationshipName($feature,"XXXXXX.NAMETabel",["OL_FIRSTNAME","OL_LASTNAME","OL_DATE"]);

var related_results = [];
for (var row in relatedtabel){
    Push(related_results, row.OL_LASTNAME + "  |  " + Month(row.OL_DATE) + "-" + Year(row.OL_DATE));
}
if(Count(related_results) == 0){
    return "Geen informatie" 
}
return Concatenate(related_results,TextFormatting.NewLine);&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 10:53:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300168#M973</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-06-16T10:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: No values are retrieved from a related table (for loop)</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300603#M980</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/188597"&gt;@MikeMillerGIS&lt;/a&gt;&amp;nbsp;,&amp;nbsp; that did the trick. Thank you so much.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Even though I also realize that I still have a long way to go to master Arcade as a subject matter.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 05:43:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/no-values-are-retrieved-from-a-related-table-for/m-p/1300603#M980</guid>
      <dc:creator>Manniej</dc:creator>
      <dc:date>2023-06-19T05:43:08Z</dc:date>
    </item>
  </channel>
</rss>

