Since one can't reference a standalone table with FeatureSetByName, like I have in line 2 below, what are my other options for Field Maps?
var plowhistory = Intersects(FeatureSetByName($map,"HistoryPlowingStatusParkingLots VIEW"), $feature);
var eventhistory = FeatureSetByName($map, "Events_view", ['eventstart'],false);
var eventhistorySorted = OrderBy(eventhistory, 'eventstart DSC')
var firsteventhistorySorted = First(eventhistorySorted)
var sql = "lastserviced > '"+firsteventhistorySorted.eventstart+"'"
var filterhistory = Filter(plowhistory, sql);
var filterhistorySort = Orderby(filterhistory, 'lastserviced DESC')
var popupString = "";
for (var myfeature in filterhistorySort){
popupString += text(myfeature.lastserviced, 'MMM DD Y, hh:mm A') + ' ' + '|' + ' ' + ' ' + myfeature.vehicleid + ' | ' + ' ' + myfeature.makemodel +
TextFormatting.NewLine
}
return popupString
There's FeatureSetByPortalItem. But do you need it to work offline for Field Maps? I feel like I've used FeatureSetByName to grab hosted tables as well, but then, they're usually in the same service, so $datastore works.
Any chance there's a relationship class in place?
@jcarlson I don't need it offline and there is no relationship.
@jcarlson The below works in the map viewer, but not in Field Maps:
var plowhistory = Intersects(FeatureSetByName($map,"HistoryPlowingStatusParkingLots VIEW"), $feature);
var eventhistory = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),"623275cbca4a485780e375e2ba4f1c5e", 1, ['eventstart'],false);
var eventhistorySorted = OrderBy(eventhistory, 'eventstart DSC')
var firsteventhistorySorted = First(eventhistorySorted)
var sql = "lastserviced > '"+firsteventhistorySorted.eventstart+"'"
var filterhistory = Filter(plowhistory, sql);
var filterhistorySort = Orderby(filterhistory, 'lastserviced DESC')
var popupString = "";
for (var myfeature in filterhistorySort){
popupString += text(myfeature.lastserviced, 'MMM DD Y, hh:mm A') + ' ' + '|' + ' ' + ' ' + myfeature.vehicleid + ' | ' + ' ' + myfeature.makemodel +
TextFormatting.NewLine
}
return popupString
@jcarlson Actually, it looks like the Filter function in lines 8 and 7 might be causing the issue in Field Maps....