Hi. Hopefully this is really simple and i'm missing something obvious. Im using the latest fieldmaps with calculated expressions. I have features with related records in the webmap and im creating smartforms for entering records. I just want to grab one of the attributes from the previous record for that feature and populate a field in the new record. The code below works but it uses the function FIRST so it grabs the first record. I just want to grab the last, but everything i try gives an error. This code works. It just return the record from the wrong end of the featureset. Is there a "LAST" equivalent to "FIRST" that will work in calculated expressions?
//Recalls the most recent record for this feature and
//returns the BaitLeftAmount attribute
var recordGUID = $feature.GUID; //Grab the current GUID
var recordset = FeatureSetByName($map,'BaitRecords'); //Grab a featureset of records
var subset = filter(recordset,"Guid = @recordGUID" ); //filter down the featureset to just those with same GUID as this one
var oneline = first(orderby(subset,'DateChecked')); //takes only one line of the featureset
var baitamount = oneline.BaitLeftAmount; //takes only one attribute from the one line
return baitamount
@JeffShaner