Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agegroup when arcade #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions any/when_agegroup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# when_agegroup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this text for the link is fine, but can you format this so it's more readable? Maybe something like "Date to age group" or something that describes the function to be used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized this doesn't deal with Date fields. It's still numbers...so it could be even more generic, like "Number to category"


This expression assigns a value of a certain age group based on the value of the column "age".
asafevenpaz marked this conversation as resolved.
Show resolved Hide resolved

## Use cases

To categorize your age data into age groups for easier analysis and visualization.

## Workflow

Create a new field of type "String" in your feature layer and name it "AgeGroup". In the "field calculator" create the following Arcade expression:

when($feature["applicant_age"]<15,'Under 15',$feature["applicant_age"]>=15 && $feature["applicant_age"]<25,'16-25','NA')
asafevenpaz marked this conversation as resolved.
Show resolved Hide resolved

In the above expression we only had two categories ('Under 15' and '16-25') but you can add as many categories as needed.

You need to always have a default value at the end of eexpression (in our example - 'NA') or you will recieve an error.
asafevenpaz marked this conversation as resolved.
Show resolved Hide resolved