Select to view content in your preferred language

calculate field

766
3
Jump to solution
10-18-2023 12:46 PM
Labels (1)
KurtRadamaker1
Occasional Contributor

I would like to add a calculated field to a feature layer.

I would like to add a count() of all rows in a feature class that contain the value of a specific column.

e.g. I have a feature class of pharmacies in california. if a row has CVS as the type of pharmacy I would like a calculated field count() of all rows in the feature class that have CVS as a pharmacy type.

The feature class may have hundreds of CVS pharmacies, CVS hollywood, CVS brentwood, CVS Malibu etc.

Every row for pharmacy type CVS would have the total number of CVS type pharmacies in california in the calculated field. 

Example: For demo purposes CVS has 3 pharmacies, Walgreens has 4
Feature Class Pharmacies

PharmacyType, PharmacyLocation, Calculated field(count() of pharmacy type)

CVS                     Hollywood                 3
CVS                     Brentwood                3
CVS                     Malibu                        3
Walgreens         Hollywood                 4
Walgreens         Brebntwood              4
Walgreens         Malibu                        4
Walgreens         LA                                4 

I succesfully did this by adding a custom arcade attribute in webapp builder, but for some reason adding this custom attribute causes the export to CSV to fail, even if is not part of the attribute table. Please DO NOT recommend using Experience Builder, since Experience builder is lacking in several WebAppBuilder Features. 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KurtRadamaker1
Occasional Contributor

I haven't recieved any suggestions for this, so I think I will write some python code to update the field

View solution in original post

0 Kudos
3 Replies
ChrisUnderwood
Esri Contributor

Hello @KurtRadamaker1 , regarding this part of your description:

"for some reason adding this custom attribute causes the export to CSV to fail"

Are you able to post any error messages, or screenshots, or sample CSVs etc, detailing this failure to export ?

0 Kudos
KurtRadamaker1
Occasional Contributor

Turns out this a known bug, csv will fail if you have any feature sets in a custom attribute.

0 Kudos
KurtRadamaker1
Occasional Contributor

I haven't recieved any suggestions for this, so I think I will write some python code to update the field

0 Kudos