Convert Amount to Words

There are several formulas available. We can add this as a saved search result as formula text or can set this in the Field level setup (Free Form Text Type) as the formula.

CASE WHEN {total}=0 THEN 'ZERO' ELSE TO_CHAR(TO_TIMESTAMP(LPAD(TRUNC({total}, 0), 9, '0'), 'FF9' ), 'FFSP') ||' ' || (CASE WHEN {total}-TRUNC({total}, 0) > 0 THEN ' AND ' || (CASE WHEN LENGTH(TO_CHAR(REGEXP_REPLACE({total}, '^[0-9]+\.', ''))) = 1 THEN TO_CHAR(TO_DATE(TO_CHAR(TRUNC(REGEXP_REPLACE({total}, '^[0-9]+\.', ''), 0)*10),'J'),'JSP') || ' ONLY ' ELSE TO_CHAR(TO_DATE(TO_CHAR(TRUNC(REGEXP_REPLACE({total}, '^[0-9]+\.', ''), 0)),'J'),'JSP') || ' ONLY ' END) ELSE ' ' END) || ' ' END

But this is tested in several scenarios and works fine for amounts with decimals also.

Leave a comment

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