4 followers Follow

Calculation using JavaScript to retrieve the item # selected in a category

Hi, all. I'm trying to create a calculated field that represents the ordinal number of a single-selection Category item. The field name is Status and the choices are "Not Started", "In Progress" and "Complete". I know I can use a nested if:

if (@Status == "Not Started") {1}
else if (@Status == "In Progress") {2}
else if (@Status == "Complete") {3}
else {0};

The problem is that if the categories change or another is added, the calculation breaks. Is there an easy way to do this, maybe using @Status.getSomething() or

Paul LeBeau

Paul LeBeau

Please sign in to leave a comment.