<?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: Calculations using related fields fail in app in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/calculations-using-related-fields-fail-in-app/m-p/1298046#M6294</link>
    <description>&lt;P&gt;If there are zero records I think this line will fail&amp;nbsp;&lt;/P&gt;&lt;P&gt;var feat = First(fs);&lt;/P&gt;&lt;P&gt;What I do is check for no records a little earlier than where you did.&lt;/P&gt;&lt;P&gt;Not proper syntax but like this - check the count on fs first.&lt;/P&gt;&lt;P&gt;if count(fs) == 0 then return '' if not then return var feat = First(fs);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am not positive you can return '' to a date field though may need to use Null.&lt;/P&gt;&lt;P&gt;Hope that makes sense.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 13:46:22 GMT</pubDate>
    <dc:creator>DougBrowning</dc:creator>
    <dc:date>2023-06-12T13:46:22Z</dc:date>
    <item>
      <title>Calculations using related fields fail in app</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/calculations-using-related-fields-fail-in-app/m-p/1297913#M6290</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;I have been building an auditing app in fieldmaps in which I have a layer for the site and a related table to undertake an audit on that site.&lt;/P&gt;&lt;P&gt;within the site layer I have built some calculations that work fine on existing sites however when I create a new site the fields return the error 'Failed to calculate' and won't let me submit.&lt;/P&gt;&lt;P&gt;I am assuming it is because there are not related records yet so it has nothing to calculate.&lt;/P&gt;&lt;P&gt;below is an example of one of the calculations to find the date of the last audit.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var fs = OrderBy(FeatureSetByRelationshipName($feature, 'WCC_Hort_Site_Auditing_XV2X_inspection_audit'),"CreationDate DES");&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var feat = First(fs);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var result = iif(IsEmpty(feat['audit_date']),'',feat['audit_date'])&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;return result;&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;does anyone have a solution for this?&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 12 Jun 2023 02:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/calculations-using-related-fields-fail-in-app/m-p/1297913#M6290</guid>
      <dc:creator>tendtreesTC</dc:creator>
      <dc:date>2023-06-12T02:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations using related fields fail in app</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/calculations-using-related-fields-fail-in-app/m-p/1298046#M6294</link>
      <description>&lt;P&gt;If there are zero records I think this line will fail&amp;nbsp;&lt;/P&gt;&lt;P&gt;var feat = First(fs);&lt;/P&gt;&lt;P&gt;What I do is check for no records a little earlier than where you did.&lt;/P&gt;&lt;P&gt;Not proper syntax but like this - check the count on fs first.&lt;/P&gt;&lt;P&gt;if count(fs) == 0 then return '' if not then return var feat = First(fs);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am not positive you can return '' to a date field though may need to use Null.&lt;/P&gt;&lt;P&gt;Hope that makes sense.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 13:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/calculations-using-related-fields-fail-in-app/m-p/1298046#M6294</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2023-06-12T13:46:22Z</dc:date>
    </item>
  </channel>
</rss>

