Number Formatting

Knackly can manipulate the formatting of numbers for a finished document. Note that our variable names may be different from yours but the formatting will remain the same after |format.


A number without formatting, for instance: 1000

{[EngagementFee]}

A number including a comma, for instance: 1,000

{[EngagementFee|format: "0,0"]}

A number with a comma and two decimal places, for instance: 1,000.00

Note: You can input however many decimal places you wish by subtracting or adding more zeroes after the decimal point. For example, to have four decimal places your formatting would look like this: |format: “0.0000”

{[EngagementFee|format: "0,0.00"]}

A number with percentages, for instance: 1000.5% or 1000%

{[if EngagementFee%1 != 0]}{[EngagementFee|format: "0,0.0"]}{[else]}{[EngagementFee]}{[endif]}%

Note: To add additional numbers on the right-side of the decimal point, add additional zeroes to the format, for example: {[EngagementFee|format: "0,0.000"]}.

A spelled-out cardinal number with a decimal, for instance: one thousand point five

{[EngagementFee|cardinal]}{[if EngagementFee%1 != 0]} point {[EngagementFee%1*100|cardinal]}{[endif]}

A spelled-out cardinal number, for instance: one thousand

{[EngagementFee|cardinal]}

A spelled-out ordinal number, for instance: one thousandth

{[EngagementFee|ordinal]}

A spelled-out money value, for instance: Fifty Dollars and Ten Cents

Dollars: {[numval|cardinal]} Dollars
Cents: {[numval%1==0 ? “No” : (numval%1*100|cardinal)]} Cents

The modulus operator (%) is the remainder operator and numval is what remains after dividing the numval by 1 - in other words, the fraction to get the cents.

Using built-ins to format numbers on Word

The Knackly Word Designer also has a few built-in formatting options. To learn more, watch the accompanying video or follow the guide below. 

After locating the number variable you are adding to your template, select the ellipsis icon menu and hover over Insert content with formatting. The following list of options will appear: 

  1. Number formatted with comma
  2. Number formatted with comma and two decimals
  3. Number formatted as cardinal number
  4. Number formatted as ordinal number

For our example, we are inserting a cardinal number followed by parentheses and the same number formatted with a comma. This is a common way to denote a written number followed by its accompanying digit.

Using built-ins to format variables in the Knackly Online Workspace

Another way to adjust number variables is to use the online workspace. In the workspace, you can set both the number of Decimal Places you want to include and the Minimum and Maximum amounts for user input. 

Note that if you include two decimal places here, the app intake will only allow a user to input up to two decimal places; however, if you use a format code from the list above in a template then the finished document will adhere to the format code and not the online workspace.

So the new filters are:

NumVal|cardinaldec  
and
NumVal|cardinalcur:"dollars"  

The former (|cardinaldec  ) has 3 optional arguments:

  • a number value indicating how many decimal places (defaults to 0)
  • a true/false value indicating whether to include trailing zeros if necessary (defaults to false)
  • a text value indicating the string to use between the integer and fractional portions (defaults to "point")

12.3456|cardinaldec  -> "twelve"

12.3456|cardinaldec:2  -> "twelve point three five"

12.3456|cardinaldec:3:"comma"  -> "twelve comma three four six"

12.99|cardinaldec  -> "thirteen"

12.99|cardinaldec:2  -> "twelve point nine nine"

12.99|cardinaldec:1::true  -> "thirteen point zero"


The latter (|cardinalcur  ) has 1 required argument and 3 optional ones:

  • a text value indicating the PLURAL name of the primary currency (such as "dollars"  ) and, if necessary, also the singular name (separated by /   : such as "dollars/dollar"  )
  • a text value indicating the PLURAL name of the secondary (hundredths) currency (such as "cents"  ) and (as above) the singular name if the plural does not end in "s". Note: If the secondary currency is omitted, the value will be rounded to the nearest integer.
  • a text value indicating what should follow the primary currency if the secondary number (e.g., the number of cents) is zero. This defaults to an empty string (""  ), but alternatively you may specify something like "and no cents"   or "and zero cents"   or "exactly"   or "only"  .
  • a text value indicating an alternative to replace "and" between the primary and secondary currency.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us