Hi all,
I am looking for some help with a calculated value in Field Maps. My very limited Arcade is letting me down and any help would be appreciated.
Background
- Using Field Maps for Damage Assessment
- Feature is DamageAssessment
- Need to calculate IsHabitable field - values are Habitable, Not Habitable, and Not Applicable
- Other factors are BuildingType and Damage
Form order sees the following:
- Select BuildingType
- options are Residential and a range of other values
- Select Damage
- options are None, Slight, Moderate, Severe and Destroyed
- Calculate IsHabitable - this is where I need help
Rules:
- For all BuildingType !== Residential, IsHabitable = Not Applicable
- Where BuildingType == Residential
- Where Damage == Severe || Damage == Destroyed, IsHabitable = Not Habitable
- For all other Damage values, IsHabitable = Habitable
The form element for IsHabitable has conditional visibility for BuildingType == Residential
Questions:
- What Arcade code can I use to calculate the result I need according to the above rules?
- This is a required field. If I have conditional visibility, will the calculation run if the condition is not met, or do I need to set a default value in the templates with IsHabitable = Not Applicable?
The calculated value has conditional Editing allowed with a switch value so users can override the calculation.