Select to view content in your preferred language

Arcade expression Feature Set from Map

1731
3
05-01-2023 12:21 PM
Labels (1)
JustinWolff
Regular Contributor

Hello, I have an Arcade expression put together for a Dashboard List, using FeatureSetByPortalItem to reference a Portal feature service.  The purpose is to create a list that sorts tracts by the latest date in any of three date type fields.  Because this is directly referencing the source feature service, and not the web map in the Dashboard, several Actions are unavailable, including 'Show Popup' and 'Zoom'. 

Instead of using FeatureSetByPortalItem(<Portal>,<Portal Item ID>), is there a way to reference the layer from a web map, or otherwise define the popup so that can be displayed as an action?

Below is the Expression referencing the Portal feature service item and layer directly.  I just can't use this to zoom or display a pop-up. 

var portal = Portal(<portal>); 

var fs = FeatureSetByPortalItem(portal,"<id>",<layer>,['*'],false); 

var date_dict = {
    fields: [{name: "MaxDate", type: "esriFieldTypeString"},{name: "Tract", type: "esriFieldTypeString"}],
    geometryType: "esriGeometryPolygon",
    features: [],
};

var acq_sql = "Appraisal IS NOT NULL and Survey IS NOT NULL and Opinion IS NOT NULL";

var acq_filter = Filter(fs, acq_sql);

for (var feature in acq_filter){
    var max_appr = Number(feature['Appraisal'])
    var max_surv = Number(feature['Survey'])
    var max_titl = Number(feature['Opinion'])
    var tract_num = (feature['tracts'])
    var max_date = Text(Max(max_appr, max_surv, max_titl));
    Push(date_dict.features, {"attributes": {"MaxDate": max_date,"Tract": tract_num},geometry: Geometry(feature)})
};

var newFeature = FeatureSet(Text(date_dict));
var orderFS = OrderBy(newFeature, 'MaxDate desc')
return orderFS

A temporary workaround I have set is an action from this data expression list to filter another list using the same filter criteria but sorted by 'tracts'.  Users have to click twice, but that's not a huge deal - would be nice to be one click though.

0 Kudos
3 Replies
ZekeMI
by
Frequent Contributor
0 Kudos
JustinWolff
Regular Contributor

Thanks GK.  I was trying this earlier, but $map isn't recognized, and I'm not sure how to define it as a variable, if it's possible.  I no longer have access to ArcGIS Assistant but would be curious to look at the .json of the Dashboard List element in ArcGIS Assistant Beta.  Maybe that would have a clue how a 'default' Dashboard element is referencing the $map.

0 Kudos
ZekeMI
by
Frequent Contributor

Apparently the global variable $map isn't available in Dashboard. As far as I know (not that far 🙂), the only action available to List elements is Filter.

I wonder if your list could filter another element that does have Zoom enabled, and the Zoom action could be automatically triggered by the list filtering action. I haven't seen Show Pop-up as an action anywhere, but never looked either. 

0 Kudos