Format Retool Database items

I am sourcing a collectionView from my Retool hosted Postgres database. How do I format numbers shown in the view? I tried formatting through javascript ( {{ '$' + item.payout.toLocaleString("en-US", {style:"", currency:"USD"})}} ), but the numbers still show as unformatted. I'm trying to show as '$#,###'

Are the numbers stored as integers in the db? Perhaps using _.toInteger()
_.toInteger(item.payout).toLocaleString(.....

There's also a formatCurrency function in the Numbro library that might save you some time
numbro(123456.789).formatCurrency() => "$ 123.5 k"

1 Like