Select to view content in your preferred language

ArcGIS Online From field only Visible where Relationship Class == [a value]

301
1
Jump to solution
02-05-2024 10:40 AM
Labels (1)
CHedger
New Contributor III

I am attempting to create a visible filter in the ArcGIS Online Configure Form. I have a Feature service (it exists in ArcGIS Enterprise) that has a historical table linked to it via a relationship class. (this is a one to many join using GloablID and TableGlobalID) I am creating the Form on the table. I want to have it where a field will only show in the form (again built on the table) where the field GENERALCLASS on the feature class == "2".

Here is my example code that i think should work but i am not very good at Arcade yet. This is being created in the Logic Visible section of the Configure form.

CHedger_0-1707158437806.png

 

var f_gid = $feature.TableGlobalID;
var related = FeatureSetByName($datastore,"DBO.DamLocations", ['GENERALCLASS'], false)
var record = Filter(related, "GlobalID = @f_gid");
var filter_record = record == "2";
return filter_record
 
Any help is greatly appreciated. 
0 Kudos
1 Solution

Accepted Solutions
CHedger
New Contributor III

I was able to figure this out for anyone curious here is the code

 

var relatedRecords = FeatureSetByRelationshipName($feature, "dbo.DamLocations");

// Check if there are any related records where GENERALCLASS is equal to "1 or 2"

var filterCondition = "GENERALCLASS = '1' or GENERALCLASS = '2'";

var filteredRelatedRecords = Filter(relatedRecords, filterCondition);

// Return true if there are matching related records, false otherwise

return Count(filteredRelatedRecords) > 0;

View solution in original post

0 Kudos
1 Reply
CHedger
New Contributor III

I was able to figure this out for anyone curious here is the code

 

var relatedRecords = FeatureSetByRelationshipName($feature, "dbo.DamLocations");

// Check if there are any related records where GENERALCLASS is equal to "1 or 2"

var filterCondition = "GENERALCLASS = '1' or GENERALCLASS = '2'";

var filteredRelatedRecords = Filter(relatedRecords, filterCondition);

// Return true if there are matching related records, false otherwise

return Count(filteredRelatedRecords) > 0;

0 Kudos