• Release History
  • Documentation
  • Back to www.mscrm-addons.com
  • Release History
  • Documentation
  • Back to www.mscrm-addons.com
home/Knowledge Base/Template Designer(DCP)/The code behind the ordinals field function (Advanced)

The code behind the ordinals field function (Advanced)

183 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
  • 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
  • How to add content from SharePoint to a document
  • Using MS Word field codes in DocumentsCorePack templates
Latest Articles
  • Document Generation via Copilot in Dynamics 365 Sales using DocumentsCorePack
  • DocumentsCorePack: Best practices for Dynamics 365 on-premises to online migration projects
  • Multilingual Support in DocumentsCorePack
  • Recap: ColorCloud 2025
  • Configure DocumentsCorePack within custom pages
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
  • 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
  • How to insert Condition Fields in DocumentsCorePack Templates designer
Categories
  • *News and General Infos* 62
  • Webinars 45
  • Template Designer(DCP 196
  • DocumentsCorePack(DCP 251
  • TelephoneIntegration (TI 65
  • AttachmentExtractor (AE 72
  • 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
  • © 2022 www.mscrm-addons.com. All Rights Reserved.