Here's my Arcade expression that should work but doesn't:
// Get the text input value from the Facility_ID__Mix_ field
var userInput = $feature.Facility_ID__Mix_;
// Define the related records using the CM_Integrated_TEST relationship
var relatedRecords = FeatureSetByRelationshipName($feature, "CM_Integrated_TEST");
// Check if there are any related records
if (IsEmpty(relatedRecords)) {
// Handle the case where there are no related records (optional)
return "No related records found";
} else {
// Loop through the related records
for (var row in relatedRecords) {
// Get the value of the unique ID field (updated variable name)
var relatedID = row.Facility_ID__Mix_;
// Check if the text input matches the unique ID
if (userInput === relatedID) {
// Fields match, return the entire related record
return row;
}
}
// Fields don't match in any related records
return "No match found for ID: " + userInput;
}