Select to view content in your preferred language

Arcade within Dashboard Category Selector

318
0
01-15-2024 02:42 PM
Labels (2)
MichaelFowler1
New Contributor III

Hello all,

I'm trying to create a category selector in Dashboard that will have an option of; Cancelled, Upcoming, Pre-decisional, Live and Complete. Due to wanting this process done automatically with minimal input from end users the 'status' field currently has; Pre-decisional, Cancelled and Other - so end users will change from Pre-decisional to either Cancelled or other depending on approval - but once approved we want that to be the last time the data needs to be edited manually. I was able to get arcade working for the symbology for the data layers using:

 

if ($feature.status == 'Cancelled') {
    return 'Cancelled'
}
else if ($feature.status == 'Pre-decisional') {
    return 'Pre-decisional'
}
else if ($feature["start_date"] <= Now() && $feature["end_date"] >= Now()) {
    return 'Live';
}
else if (Now() > $feature["end_date"]) {
    return 'Complete'
}
else if (Now() < $feature["start_date"]) {
    return 'Upcoming'
}

 

 

I tried applying the same logic to the category selector in Dashboard using the below script. In the edit data expression page there are no errors, but when i select done i get the error "Unable to execute Arcade script".  

 

var portal = Portal("portal URL")

var points = FeatureSetByPortalItem(portal, "item ID", 0, ['status', 'start_date', 'end_date'])


if ($points.status == 'Cancelled') {
    return 'Cancelled'
}
else if ($points.status == 'Pre-decisional') {
    return 'Pre-decisional'
}

else if ($points["start_date"] <= Now() && $points["end_date"] >= Now()) {
    return 'Live';
}
else if (Now() > $points["end_date"]) {
    return 'Complete'
}
else if (Now() < $points["start_date"]) {
    return 'Upcoming'
}

 

Any help would be greatly appreciated 🙂

 

 

0 Kudos
0 Replies