Saved search formula to get the last integer after a hyphen

To extract the last integer value from a text field following the final hyphen (-), the formula below can be used:

CASE 

    WHEN INSTR({field}, '-', -1) > 0 

    THEN TO_NUMBER(SUBSTR({field}, INSTR({field}, '-', -1) + 1)) 

    ELSE NULL 

END
 

Leave a comment

Your email address will not be published. Required fields are marked *