I am trying to figure out how I can make the numbers look like this? So $2.4M, $1.2K .
you can use a series of conditions (or boolean statements formatted as text), something like this..
x < 1,000 : just print the number
x >= 1,000 and < 1,000,000 : divide by 1000 and round to 1 decimal place and append K
x >= 1,000,000 divide by 1,000,000 : round to 1 decimal place and append M
You are the best! Thanks!
Can you imagine if we could use custom events as a data source (rather than action)? It would make stuff like this so much easier.
One thing we can do at the moment is use a property on a global reusable element, which we can drop anywhere. That takes the number and returns the text.
FYI: Javascript’s standard library has an answer to that: Intl.NumberFormat - JavaScript | MDN
I put together a little plugin for myself that does that: 🤌 Number formatter Plugin | Bubble
That cool!
This topic was automatically closed after 70 days. New replies are no longer allowed.


