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
Solved! Go to Solution.
@Luca_Schikowski I don't see anything wrong with the code, as its written, but it is dependent on your schema and data. Things I'd be on the look out for:
If the main provided field populated in your source data?
Do they all have the same value?
Is the main provider field on the current feature null? The filter may fail if the current feature has a null provider.
@Luca_Schikowski I don't see anything wrong with the code, as its written, but it is dependent on your schema and data. Things I'd be on the look out for:
If the main provided field populated in your source data?
Do they all have the same value?
Is the main provider field on the current feature null? The filter may fail if the current feature has a null provider.