<?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 Does anyone know how I can modify this arcade expression to use featuresetbyname rather than featuresetbyrelationshipname in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568553#M10142</link>
    <description>&lt;P&gt;I have an expression that is supposed to be used between a parent feature class and child table. The expression checks if an entered value in the child table matches a value in the parent table and returns good if so or bad if not. I've learned that featuresetbyrelationship name is bugged if there is a "." in the name of the relationship, which is unavoidable for us as we use a referenced geodatabase that has a "." in it. Does anyone know how I can modify the following script to use FeatureSetbyName and maybe the Filter function so I can avoid the relationship class? My code is below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the related rows, using the name of the relationship class
var related_rows = FeaturesetByRelationshipName($feature, "GIS.SDE.tbl_Valve_FieldPressure")

// get the latest survey
var latest_survey = First(OrderBy(related_rows, "created_date DESC"))

// return a default value if no survey was found
if(latest_survey == null) {
    return "Not surveyed yet"
}

// return good or bad depending on PSI
if(latest_survey.InputPostValvePressure == latest_survey.TargetPSI) {
    return "Good"
}
return "Adjust Pressure - See PDF for Instructions"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2024 20:20:01 GMT</pubDate>
    <dc:creator>chill_gis_dude</dc:creator>
    <dc:date>2024-12-13T20:20:01Z</dc:date>
    <item>
      <title>Does anyone know how I can modify this arcade expression to use featuresetbyname rather than featuresetbyrelationshipname</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568553#M10142</link>
      <description>&lt;P&gt;I have an expression that is supposed to be used between a parent feature class and child table. The expression checks if an entered value in the child table matches a value in the parent table and returns good if so or bad if not. I've learned that featuresetbyrelationship name is bugged if there is a "." in the name of the relationship, which is unavoidable for us as we use a referenced geodatabase that has a "." in it. Does anyone know how I can modify the following script to use FeatureSetbyName and maybe the Filter function so I can avoid the relationship class? My code is below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the related rows, using the name of the relationship class
var related_rows = FeaturesetByRelationshipName($feature, "GIS.SDE.tbl_Valve_FieldPressure")

// get the latest survey
var latest_survey = First(OrderBy(related_rows, "created_date DESC"))

// return a default value if no survey was found
if(latest_survey == null) {
    return "Not surveyed yet"
}

// return good or bad depending on PSI
if(latest_survey.InputPostValvePressure == latest_survey.TargetPSI) {
    return "Good"
}
return "Adjust Pressure - See PDF for Instructions"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 20:20:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568553#M10142</guid>
      <dc:creator>chill_gis_dude</dc:creator>
      <dc:date>2024-12-13T20:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know how I can modify this arcade expression to use featuresetbyname rather than featuresetbyrelationshipname</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568584#M10143</link>
      <description>&lt;P&gt;You can use this code to get the related features using just FeatureSetbyName&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var value = $feature.theCommonField;
var fs = FeatureSetByName($map, "GIS.SDE.tbl_Valve_FieldPressure");
var latest_survey = First(OrderBy(Filter(fs, "fieldName = @value"), "created_date DESC"));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 21:36:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568584#M10143</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-12-13T21:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know how I can modify this arcade expression to use featuresetbyname rather than featuresetbyrelationshipname</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568599#M10144</link>
      <description>&lt;P&gt;Thank you very much, that did the trick.&lt;/P&gt;&lt;P&gt;I also found a way to it without the filter function because it can fail offline sometimes. For anyone reading, here is the final script that works for me.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Load the related rows using the FeatureSetByName function
var related_rows = FeatureSetByName($map, "Valve Field Pressure")

// Get the latest survey (sorted by created_date DESC)
var latest_survey = First(OrderBy(related_rows, "created_date DESC"))

// Check if PSI fields are valid
if(latest_survey.InputPostValvePressure == null || $feature.TargetPSI == null) {
    return "Not Surveyed Yet"
}

// Return good or bad depending on PSI
if(latest_survey.InputPostValvePressure == $feature.TargetPSI) {
    return "Good PSI"
}
return "Adjust Pressure - See PDF for Instructions"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 22:14:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/does-anyone-know-how-i-can-modify-this-arcade/m-p/1568599#M10144</guid>
      <dc:creator>chill_gis_dude</dc:creator>
      <dc:date>2024-12-13T22:14:32Z</dc:date>
    </item>
  </channel>
</rss>

