<?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: Arcade date return error in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171576#M1122</link>
    <description>&lt;P&gt;I figured it out... totally overlooked changing the code in the text conversion in line 5 thanks for looking at it Josh&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2022 17:43:52 GMT</pubDate>
    <dc:creator>ScottStepro1</dc:creator>
    <dc:date>2022-05-06T17:43:52Z</dc:date>
    <item>
      <title>Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171450#M1117</link>
      <description>&lt;P&gt;Good morning,&amp;nbsp;&lt;/P&gt;&lt;P&gt;New to Arcade and was able to borrow and modify this statement from others to pull last date returns from related tables.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Background:&lt;/STRONG&gt; This is used to pull last dates from two different tables and display them in the a popup, one table is for collections, the other is for assessments.&amp;nbsp; This data is used in field to record garbage collection activities and assess overall cleanliness of a stretch of road.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What it does&lt;/STRONG&gt;: The script looks at the table, find the last record date of a selected segment and if none found, return the text "none to date".&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; As you can see from the screen shots attached, It works like a champ for the collections table but not for the assessment table and not sure why. (tables and images attached for reference)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Only noticeable difference in the tables (to me):&lt;/STRONG&gt; The collection table has finish and start date fields and attachments enabled whereas the collection table only has a single date field and no attachments.&amp;nbsp; Layer and tables were created, related and shared to AGOL via ArcMAP.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLLECTION&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var relRec = orderby(FeatureSetByRelationshipName($feature,"Collections"), "FinishTime DES");&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;var cnt = Count(relRec);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;var relatedInfo = "";&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;if (cnt&amp;gt;0) { var info = First(relRec);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;relatedInfo = Text(ToLocal(info.FinishTime),"MM/DD/Y");&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;} else var relatedInfo="None To Date";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;return relatedInfo;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ASSESSMENT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;var relRec = orderby(FeatureSetByRelationshipName($feature,"Assessments"), "AssessDate DES");&lt;BR /&gt;var cnt = Count(relRec);&lt;BR /&gt;var relatedInfo = "";&lt;BR /&gt;if (cnt&amp;gt;0) { var info = First(relRec);&lt;BR /&gt;relatedInfo = Text(ToLocal(info.FinishTime),"MM/DD/Y");&lt;BR /&gt;} else var relatedInfo="None To Date";&lt;/P&gt;&lt;P&gt;return relatedInfo;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Scratching my head...&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:23:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171450#M1117</guid>
      <dc:creator>ScottStepro1</dc:creator>
      <dc:date>2022-05-06T17:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171464#M1118</link>
      <description>&lt;P&gt;What is the expression for the assessments?&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 14:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171464#M1118</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-06T14:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171558#M1119</link>
      <description>&lt;P&gt;That would help indeed...&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATED ABOVE&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:24:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171558#M1119</guid>
      <dc:creator>ScottStepro1</dc:creator>
      <dc:date>2022-05-06T17:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171564#M1120</link>
      <description>&lt;P&gt;Found it! See bold...&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var relRec = orderby(FeatureSetByRelationshipName($feature,"Assessments"), "&lt;STRONG&gt;AssessDate&lt;/STRONG&gt; DES");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var cnt = Count(relRec);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var relatedInfo = "";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (cnt&amp;gt;0) { var info = First(relRec);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;relatedInfo = Text(ToLocal(info.&lt;STRONG&gt;FinishTime&lt;/STRONG&gt;),"MM/DD/Y");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;} else var relatedInfo="None To Date";&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171564#M1120</guid>
      <dc:creator>ScottStepro1</dc:creator>
      <dc:date>2022-05-06T17:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171566#M1121</link>
      <description>&lt;P&gt;Hm. I figured they were probably pretty similar. The only thing I can figure is that there's some error happening earlier in the expression. Since you initially set the&amp;nbsp;&lt;STRONG&gt;relatedInfo&lt;/STRONG&gt; variable to an empty string, maybe that's what is being returned?&lt;/P&gt;&lt;P&gt;Try changing that third line to "var relatedInfo = 'test value'" and see if your popup returns that, or if it's truly not returning anything at all.&lt;/P&gt;&lt;P&gt;Another idea is to include some Console commands in your expression to check the output. Maybe include&amp;nbsp;&lt;STRONG&gt;Console(relRec)&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;Console(cnt&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; to see if your initial steps are returning what you expect.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171566#M1121</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-06T17:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171576#M1122</link>
      <description>&lt;P&gt;I figured it out... totally overlooked changing the code in the text conversion in line 5 thanks for looking at it Josh&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:43:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171576#M1122</guid>
      <dc:creator>ScottStepro1</dc:creator>
      <dc:date>2022-05-06T17:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade date return error</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171584#M1123</link>
      <description>&lt;P&gt;Any time! Sometimes just sharing the problem makes it clearer to you, even if you end up figuring it out for yourself.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 17:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-date-return-error/m-p/1171584#M1123</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-06T17:51:18Z</dc:date>
    </item>
  </channel>
</rss>

