Assign values to strings for sorting

I have an attribute showing the damage to parts of a building using text and I would like to be able to group by the building and get the maximum damage level for any part of the building.
The ordering of the damage levels is
['none','low','moderate','significant','extreme']
so I would like

riskscape expression eval "max(['moderate','significant','extreme','low'])

to return ‘extreme’, but currently it returns ‘low’.
Is this possible or do I need to convert the damage levels to integers and then back to strings after grouping?

Hi John,

Good question. Using max() to with string inputs like that isn’t something that is commonly done in RiskScape, and there is actually a bug in our backlog for it not working correctly (ticket #871). So my advice would be to work in integers and then convert them back to strings later.

Cheers,
Tim