Number Value to Display Ordinal Number in Print Template

Hi everyone. I have a field called “Number” which gives the number of a document. Is there a way to make that number display as the ordinal number in the print template, i.e. “1” display as “First” in the print template?

Hi Dawn,

It’s absolutely possible to set up ordinals in Agiloft. The trick is that for fields that keep counting up indefinitely, you have to plan for every ordinal they might reach. In other words, you have to think of how you’ll link document 6371 to the text “six-thousand three-hundred and seventy-first”, if you’re planning to enable ordinals that big.

As a starting point, you can create an integers-to-ordinals table to link to from your documents table.

  1. Create an Ordinals table which contains an Integer field and an Ordinal field. You can create however many you think you’ll need - but there’s currently no “unlimited” option. You’ll probably want to import them from a spreadsheet, such as:

Integer Ordinal
1 _______ First
2 _______ Second

  1. In the Attachments or other document table, create a link to single field from other table (or link to selected) to the Ordinal field of the Ordinals table. On the Options tab, set the value for the imported fields based on the values from the record(s) in which the Integer field matches the Number field in the current Attachment. Choose the record in which the value of the ID field is less than all other matching records.

  2. You’ll have to edit each record in order to make them update this new field with the correct default. An easy way to do this is to mass-edit the Demo Data field to “No” for all records in the document table.

  3. In the print template, simply include the linked field ($ordinal, or whatever you named the link in the document table). Any Number larger than your largest Ordinal will simply be shown as blank, but you can use conditional text to display the original Number field in that case, such as $startif($number > 99) Please find document number $number attached. $endif $startif($number <= 99) Please find the $ordinal document attached. $endif

Hopefully that answers your question. Thanks for posting!


Hi again Dawn,

In looking into this post, I found an excel spreadsheet with integers and their ordinals going up to “Ninety-Ninth”, but the forum doesn’t accept uploading of spreadsheets. Please message me if you’d like me to email that spreadsheet to you directly!


There is a pretty straightforward solution documented in the Wiki: Troubleshooting Print Templates see item #2. You’d need to adapt the formula, but once you make the modifications, it works for any number.
I use it in many Print Templates for the Contract Start Date.