finance.currency.amount_neg_trailingCurrency amount with trailing minus sign or CR/DR suffix for negative values. Standard in SAP, COBOL/mainframe exports, and bank statement formats. The negative indicator follows the amount.
$ finetype infer -i "$1,234.56-"
→ finance.currency.amount_neg_trailingSELECT finetype('$1,234.56-');
-- → 'finance.currency.amount_neg_trailing'CAST(CASE WHEN {col} LIKE '%-' OR {col} LIKE '%CR' THEN '-' || REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE({col}, '[-]$|\s*(CR|DR)$', ''), '[\$€£¥₹]', ''), ',', '') ELSE REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE({col}, '[-]$|\s*(CR|DR)$', ''), '[\$€£¥₹]', ''), ',', '') END AS DECIMAL(18,2))-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS VARCHAR) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'finance.currency.amount_neg_trailing';is_negative: CASE WHEN {col} LIKE '%-' OR {col} LIKE '%CR' THEN true ELSE false END{
"$id": "https://meridian.online/schemas/finance.currency.amount_neg_trailing",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Currency amount with trailing minus sign or CR/DR suffix for negative values. Standard in SAP, COBOL/mainframe exports, and bank statement formats. The negative indicator follows the amount.",
"examples": [
"$1,234.56-",
"1,234.56 CR",
"$999.99-",
"10,000.00 DR"
],
"pattern": "^[\\$€£¥₹]?[0-9]{1,3}(,[0-9]{3})*(\\.[0-9]{1,2})?\\s?(-|CR|DR)$",
"title": "Currency Amount (Trailing Negative)",
"type": "string",
"x-finetype-broad-type": "VARCHAR",
"x-finetype-transform": "CAST(CASE WHEN {col} LIKE '%-' OR {col} LIKE '%CR' THEN '-' || REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE({col}, '[-]$|\\s*(CR|DR)$', ''), '[\\$€£¥₹]', ''), ',', '') ELSE REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE({col}, '[-]$|\\s*(CR|DR)$', ''), '[\\$€£¥₹]', ''), ',', '') END AS DECIMAL(18,2))"
}$1,234.56-1,234.56 CR$999.99-10,000.00 DR