Selecting Characters from a String
There are a few options to select only certain characters from a string.
An example of a use case for this functionality is if some values in an AGE
column have age ranges formatted as 45-55
instead of ages. To convert these to just the first part, in this case 45
, while leaving regular ages as before, you could use the split
function in a formula transformation:
get(split(get(AGE, 0), '-'), 0)
You could alternatively use a regular expression with extract_all
or extract
, for instance:
get(extract_all(get(AGE, 0), '[0-9]*'), 0)
For a full list of supported functions, see the documentation.
Updated over 2 years ago