Counting Features with a specific attribute not working

66
0
06-16-2022 04:54 AM
Luca_Schikowski
New Contributor II

Good morning,

I try to count all adresses (in my Device Layer) with a specific attribute (MainProvider). For that, i tried the following code (as mentioned here: UN Attribute Rules Expression Builder Arcade😞

// load all addresses
var addresses = FeatureSetByName($datastore, "AddressTableName", ["MainProvider"], false)

// filter the addresses for the main provider of the active feature
var provider = $feature.MainProvider
var filtered_addresses = Filter(addresses, "MainProvider = @provider")

// count and return error message
if(Count(filtered_addresses) > 25) {
    return {"errorMessage": "A provider can't supply more than 25 addresses!"}
}

// if we land here, the provider has <= 25 addresses
// rest of your code

When I use this code, the value of "filtered_adresses" is always identical with the amount of features in my device layer. So I guess the Filter is not working like this.

Do you know what I can do here? Or is there another way to get this done? Thanks in advance! 
Luca

0 Kudos
0 Replies