I am looking for some help regarding an Arcade script that I am developing for the ESRI Dashboard List Widget. Essentially, I have a hosted feature table that has duplicate records based on "unique_user" but must remain split due to some non-duplicate attributes. I would like to only display only one DISTINCT record, based on "unique_user." As long as the script only returns one $datapoint then that is fine - the index does not matter.
Here is what I have so far, any thoughts on how to only return one distinct value per "unique_user"?
// different categories of days anticipated
var perm_status = $datapoint["perm_status"]
var dateTechReviewComplete = Date($datapoint["dt_tech_review_complete"])
// extra variables
var dateSubmitted = Date($datapoint["dt_submitted"])
var nowDate = Date(Now())
if (perm_status == "Technical Review Complete") {
var tech = DateAdd(dateTechReviewComplete, 195, 'days')
var daysAnt = Text(tech, "MMMM D, Y")
var dateDifference = Round(DateDiff(tech, nowDate, 'days'))
// Return only one DISTINCT date based upon "unique_user"
}
else {
var daysAnt = "No Permit Status Reported"
return True
}
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
daysAnticipated: daysAnt,
permitStatus: perm_status,
daysDifference: dateDifference
}
}
This is what the code currently returns, duplicates have a red mark next to them:

The desired result is that only one of the duplicate rows is returned.