Kofax TotalAgility 7 has a built in date formatter which supports the same functionality as the date formatter used in Kofax Transformation Modules (KTM), although without support for a dictionary to replace month names with the corresponding month number. Extending our Kofax TotalAgility knowledge series, I am presenting an easy DIY solution to build this functionality in TotalAgility.
5 Easy Steps to Extend Date Format Function in KTA7
1Default Date Formatting in TotalAgility Workspace
Below is the default date formatter on KTA:
Note: Ambiguous date formatting works only on KTA 7.2 and higher
2Custom Field Formatters in KTA7
Business rules can be used for creating custom field format functions; so let’s create a new Business Rule. In our example we are calling it “CustomDateFormatter 2.3”.
In the business rule itself, all automatic activities (except for capture activities) can be used to create the desired output. In our example we take a two step approach using an Expression activity followed up by a .Net activity.
3Create Input / Output Variables
Create a new business rule and configure the variables as shown in the following screenshot.
A field format business rule needs to have the exact input and output variables in order as described below. Click the “Input / Output Order” link on the top right of the variable definitions to view and amend the order, if necessary.
4Create Expression Activity for Replacing Month Names
The first node in the business rule is an expression activity. The first element in the expression activity should be a ‘LowerCase’ expression to convert all characters to lower case; this make the subsequent expressions less complex.
The remaining elements of the expressions will replace the month names to their respective numbers. e.g.
The expression actions are executed in order. Do keep in mind that month names always have to be in order of length/complexity otherwise the logic won’t work. So for example, the month January can be described in multiple ways: January, Januari, Januar, Jan.
When putting ‘jan’ before ‘januari’ the output for ‘01-januari-2015′ will be ‘01-01uari-2015′. Keep an eye out for overlap in your replace functions to safeguard yourself against getting trapped in such situations.
5Create .Net Activity to Harness the Flexibility of Kofax TotalAgility
The enormous flexibility in Kofax TotalAgility comes from its ability to use custom .Net libraries. After we have replaced the month names, the ‘cleaned’ date needs to be formatted to the desired output format.
You can use the .Net library of TotalAgility to call the default date format field formatter as shown in the first screenshot above. To do this create a .Net activity and configure the settings as shown in the following screenshot.
Now just release your Business Rule.
Release and Test Date Format Function in KTA7
We will create a new Date Formatter in KTA; which we will name “Custom Date Formatter 2.3” (since it is a customization of our “Default Date Formatter 2.3”). We select it as type “Business Rule” and configure it to consume the Business Rule created above.
You will now be able to using the “testing” feature to ensure it is working as you expect it to.
Thanks for reading my blog post and I hope it helps you serve your business needs by implementing this solution in many of your Business Process Management and/or Dynamic Case Management projects implemented in Kofax TotalAgility 7.
If you have any questions or suggestions, please feel free to leave your valuable comment.