Hi Y'all,
This is probably a novice arcade question but I am tired of banging my head on the keyboard.
Background:
I have a FS on a Portal that is a running list of points that are being populated by a geoform. The data collected is the status of tools (18 items in a dropdown) in our utilities tool room (checked in or out - text dropdown) and as well as other information. I am trying to show the status of each tool using the GroupBy function for a data expression inside a dashboard.
Problem:
All of the statistics I need are availablefor each tool group in the list except the text field “Status”. I am struggling to figure out how to show the latest “Status” (in or out) for each tool, because ‘LAST’ is not a choice. (Possible Values: SUM | COUNT | MIN | MAX | AVG | STDEV | VAR). Obviously if I use ‘MAX’ it will return the “Out” every time because it is ‘MAX’ in the alphabet. If I get the MAX “ObjectID”, is there a way to link it to the “status” in the same row? Or am I just hopeless?
In the end all I really need to show is if a tool is checked in or out of the room based on the latest point in a group.
I’m open to any ideas.
Here’s the Arcade expression as it stands:
var portal = Portal('https://gis.myorg.org/portal/');
var fs = FeatureSetByPortalItem( portal,'8787864654654654654654654c', 10,
['Tool_Description',
'last_edited_date',
'Status',
'OBJECTID'], False );
Var allstat = GroupBy(fs, ['Tool_Description'],
[
{name: 'LastDate', expression: 'last_edited_date', statistic: 'MAX'},
{name: 'Status', expression: 'Status', statistic: 'COUNT'},
{name: 'OID', expression: 'OBJECTID', statistic: 'MAX'},
//Possible connection to the LAST "Status" in a row
{name: 'OIDtoIN', expression: 'OBJECTID*1', statistic: 'MAX'},
//OIDtoIN is to relate lists
])
Return allstat
Thanks,