mscrm-addons.com logomscrm-addons.com logo
  • Release History
  • Knowledge Base
  • Documentation
  • Contact Support
  • Release History
  • Knowledge Base
  • Documentation
  • Contact Support
home/Knowledge Base/Template Designer(DCP)/The code behind the ordinals field function (Advanced)

The code behind the ordinals field function (Advanced)

193 views 0 Updated on July 30, 2024

The following information provides you with a technical description of the ordinals field functionality. For further information on the functionality itself, please have a look at this article.

This is what the function looks like:

Note: The delimeter for methods (such as MOD) is dependent on the localization of your system.  For English systems, the delimeter is the comma (“,”) whereas for German systems, the delimeter is the semicolon (“;”).  As an example, the above function MOD(day;100) would be correct for German systems, but not English systems.

The below table describes what happens behind the scenes. The left column contains a structure chart that visualizes the procedure. The two columns on the right contain examples that run parallel to the structure chart and intend to help to understand the algorithm.

SET date field to internal variable “day” with the formatting “d”
(the “d” formatting only displays the day as a number; (this would also work with actual number fields and might require no or a different formatting)

Example “createdon” with the value “11/24/2016” and the switch formatting d results in “24”

Example “createdon” with the value “11/3/2016” and the switch formatting d results in “3”

SHOW day

24

3

SET the helper variable “goon” to 0

“goon” is 0

“goon” is 0

CALCULATE the module of day by 100 and store the result in variable “result1”

“result1” is 24

“result1” is 3

CALCULATE the module of day by 10 and store the result in variable “result2”

“result2” is 4

“result2” is 3

IS “result1” equal “11”

No

No

Yes

No

No

No

Print “th”

IS “result1” equal “12”

Yes

No

No

No

Print “th”

IS “result1” equal “13”

Yes

No

“goon” is 1

“goon” is 1

Print „th”

SET the helper variable “goon” to 1

IF “goon” is equal to “1”

Yes

Yes

No

Yes

No

No

Nothing

IS “result2” equal “1”

Yes

No

Nothing

Nothing

Print „st”

Nothing

IS “result2” equal “2”

No

No

Yes

No

Nothing

Nothing

Print „nd”

Nothing

IS “result2” equal “3”

No

Yes

Yes

No

Nothing

Print “rd”

Print „rd”

Noting

IS “result2” higher than “3”

Yes

No

Yes

No

Print “th”

Nothing

Print „th”

Nothing

That’s it! We appreciate your feedback! Please share your thoughts by sending an e-Mail to support@mscrm-addons.com.

Was this helpful?

Yes  No
Related Articles
  • Debugging the Template Design Office Add-In 
  • Introducing the DocumentsCorePack Template Designer Office Add-In
  • Ensuring correct time zone display for DateTime fields
  • How to compare a date-fields with the current date 
  • Create a template for XML or plain text
  • E-Invoicing with DocumentsCorePack
Latest Articles
  • Locating Raw Inputs and Outputs in Power Automate
  • Step by Step: How to execute an OCA in a Power Automate flow 
  • The Hidden Cost of CRM Storage — And How to Eliminate It 
  • Recap: Nordic Summit 2025
  • The new Template Designer Office Add-In
Popular Articles
  • DocumentsCorePack Template Designer – Getting Started
  • Step-by-Step: How to configure a One-Click-Action
  • Application Access for Dynamics 365
  • How to find your environment’s unique name in Microsoft Dynamics 365
  • How licenses are counted
Top Rated Articles
  • “Undefined”-labels in Chrome and Edge 114 and higher
  • How to insert Condition Fields in DocumentsCorePack Templates designer
  • Important information for Dynamics 365 online customers using DocumentsCorePack and/or AttachmentExtractor
  • How to activate the DocumentsCorePack Connector for PowerApps & Microsoft Flow
  • How licenses are counted
Categories
  • *News and General Infos* 65
  • Webinars 46
  • Template Designer(DCP 197
  • DocumentsCorePack(DCP 262
  • TelephoneIntegration (TI 65
  • AttachmentExtractor (AE 76
  • PowerSearch (PS 50
  • ActivityTools (AT 61
  • SmartBar (SB 54
  • GroupCalendar (GC 47
Our Vision

“We see it as our purpose to provide products that simplify and speed up our customers’ Microsoft Dynamics 365 experience.”

Knowledgebase
LogIn
mscrm-addons.com
  • Products
  • Online Shop
  • Downloads
  • My Account
About Us
  • About Us
  • Case Studies
  • Newsletter
  • Partner Program
  • Contact
Support
  • Support
  • Terms & Conditions
  • Documentation
  • Webinars
  • Legal Documents
  • Impressum
  • © 2025 www.mscrm-addons.com. All Rights Reserved.