Select to view content in your preferred language

Issue with custom Arcade expression for Table using text field

741
2
10-25-2022 12:09 PM
Labels (1)
TiffMaps
Emerging Contributor

Hello, I am working on writing Arcade expressions for a dashboard table element. I would like to assign a color to the record based on a dominant attribute class (that is based on a numerical field - greatest area) and I am struggling with a workflow to accomplish this.

I can perform this workflow when the data layer is a data expression, but this is not ideal because it 1) does not allow table action to zoom to map, and 2) does not work with my dynamic charts due to the altered fields.

Here is what I am not able to figure out: I have a table where one field has multiple records with the same name, and thus I need to use the "Grouped values" type. However, I have also prepared the data with categorical attributes in the table that I would like to be able to retain, rather than a Count of values, which it defaults to. How can I reference the names from this text field without using a data expression, in order to assign the correct color to the table record?

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

If your data expression returns the objectid of the original features and retains the geometry, there's no reason you couldn't still have map-based actions and dynamic filtering of other elements.

Any chance you could share the data expression you used? I think it would help to clarify how you're working with your data, and the intended output. It sounds rather complex, but not impossible.

- Josh Carlson
Kendall County GIS
0 Kudos
TiffMaps
Emerging Contributor

I would love to be able to figure it out using the data expression - seems like the best (if not only) option. Some background: my feature layer includes a list of sites that are dissolved based on site and unique classes, so each site has a number of records. I pre-prepared my feature layer to have a field that denotes the dominant class, which I think is why it's challenging to connect it back to the other elements.

I use the FeatureSetByPortalItem function first to pull in the data, and then use the GroupBy function to group by the overall site name - that would be the map action, and return three fields (including dominant class). It doesn't seem to support the chart actions because they are referring to a different subset of attributes, although related.

return GroupBy(fs, ['SITE_NAME'], [
    {name: 'num_classes', expression: 'ClassName', statistic: 'COUNT'},
    {name: 'total_acres', expression: 'Acres', statistic: 'SUM'},
    {name: 'dominant_class', expression: 'DominantClass', statistic: 'MAX'}]);

 

Not sure if this is helpful, but I think an analogy for this would be paintings with primary and secondary colors. Each painting may have a dominant color but also is associated with a bunch of other color combinations, but that is lost when I try to link only the dominant color to the other elements. If a painting's dominant color is blue, but I want to see all information about that painting, I would need to be able to see all the other color combinations. The table wouldn't have a way to link it (based on how my code is written now) since it will not recognize any of the ones outside of the dominant color nor those with also a secondary color.

 

0 Kudos