Select to view content in your preferred language

Multiple Fields and When/If Statements?

491
2
12-17-2018 02:27 PM
deleted-user-jxpbpbjlZInj
Deactivated User

I have multiple boolean fields in (1,0) and if they have a 1 they should have a score associated. I have many of these and don't want to write if statements for every single one. How can I string them all together? 

I tried:

 

When($feature.Cracks == 1,$feature.Sc_Cracks,

$feature.Branch_Unions == 1,$feature.Sc_Branch_Unions,

$feature.StemBranch_Decay == 1, $feature.Sc_StemBranch_D,

$feature.Fungal_Bodies == 1,$feature.Sc_Fungal_Bodies,

$feature.Cankers == 1,$feature.Sc_Cankers,

$feature.DeadTree_Top_Branch == 1,$feature.Sc_DeadTopBrch,

$feature.Beetles == 1,$feature.Sc_Beetles,

$feature.Root_Damage == 1,$feature.Sc_Root_Damage,

$feature.Architecture == 1,$feature.Sc_Architecture,'')

But it would only return one value, not all of them (if there were more than one.) I don't think it likes the multiple fields.

Help pleasseeeee! 

0 Kudos
2 Replies
StephenM
Frequent Contributor

I think each expression can only return one value, so that's why you're having that issue. You might be able to return an array, but it depends on what you're looking to do and what your data looks like.  Are you trying to modify pop-ups, the way the data displays, or something else?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Since you trying to combine multiple scores, are you trying to get the total score for those related fields when the boolean is 1?

0 Kudos