Return non-used domain values in Dashboard List

02-18-2022 09:24 AM
New Contributor II

Good day all!

I have a dashboard set up that summarizes the current status of ongoing construction projects.  In my projects layer, I have a field for Inspector, which references a domain list consisting of all available inspectors.  I am attempting to set up a list widget that lists all of the available inspectors found within that domain that are not currently assigned to a project.  I have played around with the domain function in Arcade, but seem to be having trouble getting it to work properly.  

I am curious if this is even a possibility, but I thought I would throw it out there to see if anyone had ever attempted something similar.  Any input you could provide would be most welcomed!

0 Kudos
1 Reply
Occasional Contributor

This should be possible using a combination of the FeatureSetByPortalItem (or any of the other FeatureSet functions) and Schema. Schema allows you to get all of the coded domain values via the fields/domain properties. 

Something like this:

var somelist = []

function myfilter(someval){
    return indexOf(somelist, someval) == -1

var coded_values = Schema($feature)['fields'][4]['domain']['codedValues']

for(var i in coded_values){
    Push(somelist, coded_values[i]['name'])

var fs = FeatureSetByPortalItem(Portal('PORTALURL'), "ITEMID", LYR_INDEX)

var in_use_list = []

for(var f in fs){
    Push(in_use_list, f.FIELDNAME)
return Filter(in_use_list, myfilter)
0 Kudos