Are the Arcade FeatureSet functions supported in Collector?

9388
36
Jump to solution
03-01-2019 11:39 AM
KevinMayall
Occasional Contributor III

I have created Arcade expressions that display pop-up data from a related table using FeatureSets.  They work in ArcGIS Online but not in Collector.  Does Collector (the new iOS version) support FeatureSets?

Kevin
36 Replies
MarkEastwood
Occasional Contributor II

Is there a list of arcade functions that are supported in Field Maps documented anywhere? FeatureSet does seem to be working but if I have the Filter() function as part of my expression it returns blank.

 

// Acess 'Bridge Attributes' table as a FeatureSet
var bridgeAttributes = FeatureSetByName($map,
    "Bridge Attributes", ['*'])

// Filter related features by using globalid
var GlobalID = $feature.globalid
var filterStatement = 'rel_globalid = @Globalid'

// Related features as a variable
var relatedData = Filter(bridgeAttributes, filterStatement)

// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedData){
    
    popupString += DefaultValue(f.client_name, 'no data') + TextFormatting.NewLine +
    
        "Bridge Name: " + DefaultValue(f.bridge_name_num, 'no data') + TextFormatting.NewLine
}
return popupString

 

This expression works fine in the web map but returns blank in Field Maps...

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

I am using Filter like this and it works in Field Maps.  Looks like your SQL maybe formatted wrong.

var sql = "PointID = '" + $feature.PointID + "'";
var tbl = Filter(FeatureSetByName($map,"Points", ['*'], false), sql);
var val
for (var row in tbl) {
    val = row.DesignLat
}
return val

 

Hope that helps.

0 Kudos
MarkEastwood
Occasional Contributor II

Thanks Doug,

Interesting that it is working for you...

I updated the expression as you suggested and am still seeing a blank return in Field Maps.

var sql = "rel_globalid = '" + $feature.globalid + "'";
var tbl = Filter(FeatureSetByName($map,"Bridge Attributes", ['*'], false), sql);
var val 
for (var row in tbl){
    val = row.client_name
}
return val

When I update the expression to not include the Filter function it works.

var sql = "rel_globalid = '" + $feature.globalid + "'";
var tbl = FeatureSetByName($map,"Bridge Attributes", ['*'], false);
var val 
for (var row in tbl){
    val = row.client_name
}
return val

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Hmm looks ok.  Only other thing I can think of is in AGOL the case is usually GlobalID (not globalid).  Check the exact case sensitive of yours and see.  Make sure to check the real name and not the alias.

I personally never use GlobalID for the relate for the reasons listed here

https://community.esri.com/t5/arcgis-collector-questions/related-tables-for-offline-data-collection/... 

0 Kudos
MarkEastwood
Occasional Contributor II

Thanks Doug,

Ugh, it looks like $feature.globalid (or $feature.GlobalID) can't be used in the Filter function sql when consumed by Field Maps. If I hardcode in a GlobalID it works and if I filter using another field it works.

Very annoying.

Mark

MarkEastwood
Occasional Contributor II

Got it working.

Just incase anyone runs into this post and is wondering I ended up needing to wrap the $feature.globalid with the Upper() function. The character values in my GlobalIDs were returning in lower case in Field Maps but the actual GlobalID values have upper case characters.

 

var sql = "rel_globalid = '" + Upper($feature.globalid) + "'";
var tbl = Filter(FeatureSetByName($map,"Bridge Attributes", ['*'], false), sql);
var val = ''
for (var row in tbl){
    val += row.client_name
}
return val

 

 

DougBrowning
MVP Esteemed Contributor
0 Kudos