Using a transformer to change enum values from database


I am trying to translate the data into a humanized/readable state from the database resource. Currently, An Account Type / Account Status field is represented by what I believe it to be an enum value rather than a string. Ideally, it should be Account Status 0 = Closed and 1 = Open.

Is there a way to use a transformer to replace the enum values? I want to use a transformer so that I can save multiple queries into the query library which will enable immediate translation for all of the tables in the database WITHOUT mapping values on a table manually each time. Please let me know if anyone can help. Thanks!

You could use the following in the Mapped Value field of the AccountStatus column:
{{self == '0'?'Closed':'Open'}}. (assuming the 0 or 1 are strings? If not then remove quotes...)

Is there a way to use a transformer for this instead of a mapped value?

You can write it in your SQL?

    WHEN AccountStatus=0 THEN 'Closed'
    WHEN AccountStatus=1 THEN 'Open'
    DEFAULT 'unknown'
END AS AccountStatusText
FROM tablename

Thank you! I think this could be a short-term solution. I appreciate it.