<?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: Date Diff of Feature and Related Table in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204601#M58879</link>
    <description>&lt;P&gt;Thanks for the help.&amp;nbsp; That still didn't seem to work though.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_0-1660927244149.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/49019i681FB0CA84D90579/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_0-1660927244149.png" alt="JasonCyphers_0-1660927244149.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 16:40:58 GMT</pubDate>
    <dc:creator>JasonCyphers</dc:creator>
    <dc:date>2022-08-19T16:40:58Z</dc:date>
    <item>
      <title>Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204194#M58825</link>
      <description>&lt;P&gt;How can I calculate the difference, in days, between a date on a hosted feature layer and a date on a related table record?&lt;/P&gt;&lt;P&gt;I have a report point, that captures information about a repair that needs to be made, and a related table that captures information about the repairs that were made.&amp;nbsp; I'd like to be able to use arcade to determine how many days lapsed between the point being added and the point being repaired.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 15:04:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204194#M58825</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-08-18T15:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204265#M58829</link>
      <description>&lt;P&gt;Should be pretty straightforward. With related tables, you just need some way to sort / filter the table, to make sure that you're getting the right record, then just pull out its particular date field.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var repairs = FeatureSetByRelationshipName($feature,"relationshipname")

var recent_repair = First(OrderBy(repairs, 'created_date DESC'))

var repair_date = recent_repair['created_date']

var report_date = $feature['created_date']

return DateDiff(repair_date, report_date, 'days')&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Aug 2022 18:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204265#M58829</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-08-18T18:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204276#M58832</link>
      <description>&lt;P&gt;So, if I created an attribute on the point feature called "days_to_repair", I could use the above script in Pro to calculate the values?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 18:38:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204276#M58832</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-08-18T18:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204281#M58833</link>
      <description>&lt;P&gt;Yes, I imagine so.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 18:46:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204281#M58833</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-08-18T18:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204469#M58863</link>
      <description>&lt;P&gt;I tried... no luck &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_0-1660909544476.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48987i9C947056EED8B6E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_0-1660909544476.png" alt="JasonCyphers_0-1660909544476.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Script works great in a Portal map pop-up, to display the # of days to repair (I was even able to include some code to display the duration in hours if it was less than a day), so not sure why it won't populate the field in Pro.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 11:52:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204469#M58863</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-08-19T11:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204494#M58867</link>
      <description>&lt;P&gt;Hm. I would guess it's encountering a null value somewhere. Let's throw in some code to check for values first.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var repairs = FeatureSetByRelationshipName($feature, 'report_repairs')

// check for existence of values in related table first

If (Count(repairs) == 0){
    Console('No related records!')
    return null
} else {
    var recent_repair = First(OrderBy(repairs, 'created_date DESC'))
    // put the rest of the code in these brackets
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Aug 2022 13:17:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204494#M58867</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-08-19T13:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date Diff of Feature and Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204601#M58879</link>
      <description>&lt;P&gt;Thanks for the help.&amp;nbsp; That still didn't seem to work though.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_0-1660927244149.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/49019i681FB0CA84D90579/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_0-1660927244149.png" alt="JasonCyphers_0-1660927244149.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 16:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/date-diff-of-feature-and-related-table/m-p/1204601#M58879</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-08-19T16:40:58Z</dc:date>
    </item>
  </channel>
</rss>

