Getting math columns to show a .00 afterwards

Currently the math column is set to 2 decimal places (1.00) precision. Also using TRUNC(,2) to make sure its 2 decimal places. The issue is that when using it as a value inside of a PDF, if a number is rounded (3000) it shows up as that on the PDF instead of 3000.00, so it looks extremely untidy when you’ve got 3000, then 2954.76, etc. How do I get it to show the .00 after even if its a whole number? (Also creating the PDF via PDF monkey if that changes anything)

Hola!

What if you send your number as a text to PDF Monkey (“2954.76”) ?

Just create a new column as Template to get it.

Saludos!

A little bit of a long con, but here’s what you need.

Testing with num = 3000.

Testing with num = 2954.76

Testing with num = 2954.8

{% assign num_split = num | round: 2 | split: "." %}
{% assign integral = num_split[0] %}
{% assign fractional = num_split[1] | append: "00" | truncate: 2, "" %}

Formatted Number: {{integral}}.{{fractional}}

@Darren_Murphy Here’s the Liquid thing I told you about the other day. One of its advanced use cases.

2 Likes