Number formatting

I displaying some numbers from a pageData payload originating from a table.
These numbers currently have 16 decimals, so is there a way to format that down to 3 decimals using handlebars?

Hi @Lars_Andersson,

The {{format}} helper should do the trick here!

Thanks,
Julia

I tried {{format mynumber}} and {{format mynumber ‘,.6’}} but that didn’t change anything.

I think I figured that one out. the “mynumber” variable was a string.

Can I convert string to number with {{format}} too?
I have tried to find that before asking, but no luck.

@Lars_Andersson,

I recommend using the String Node. :hugs:

Yeah, I was looking at that, but since I am calling rows from a table and not all columns should be converted to numbers, it seemed easier to just convert the proper DataTable columns from string to number, so that’s what I ended up doing.

1 Like