I have a webmap that displays existing curb ramp points intended for use on an iPad with the Collector app. The popups have a custom url to open Survey123 for the user to fill out an inspection for this curb ramp. However, if the user is inspecting a NEW curb ramp, they collect the point in collector and the popup displays what the asset id (UNITID) should be as the last UNITID value +1 by using an expression (code attached). I want to pass this expression to Survey123....is this possible?
In testing, the popup works correctly showing the ID if it exists, and calculates the next ID if it doesn't. (This does not work if there are multiple assets with no ID, since they would have the same ID, but this is an experiment)
UID Calc Expression {expression/expr7}
var exist_uid = $feature.UNITID
//grab the highest number asset id
var curbramps = Top(OrderBy((FeatureSetByName($map,'Curb Ramps', ['UNITID'], false)), 'UNITID DESC'), 1)
//calculate the last id+1
for (var cr in curbramps)
var max_uid = Number(Right(cr.UNITID, 5))+1
}
//curb ramp is tagged as CR12345
var new_uid = Concatenate("CR", max_uid, '')
//if the unit id exists, pass the value. if not, pass the last value+1
iif(isEmpty($feature.UNITID), new_uid, $feature.UNITID)
;
Hyperlink to send ID to Survey123
arcgis-survey123://?itemID=a9b85207d13247218d3bb3eb575919f3&field:UNITID={expression/expr7}
Many thanks for your help!!!