How to Read the Check Digits in RTF Template
It is an important business need that B2B would use Check to trade. Oracle also has such functions available in BI Publisher reports. Normally, for security reasons, users always expect to display both digits and characters to match each other so that the check can't be forged.
For example, £120 will be displayed as One Hundred and Twenty Pounds Sterling And Zero Pence. Oracle seeded report also adopted this way of displaying:
It will display the figures in this way:
In this post, you will learn how to split each digit of the figure and then display them in words. For example, £12 would be a two on unit digit and an one on tens digit:
Here we prepared 6-digit fields (should be enough, otherwise you can add more digits based on the below logic), for the unit digit we passed the following command in the properties:
领英推荐
<?xdofx:to_check_number(substr(lpad(OutboundPaymentInstruction/InstructionTotals/TotalPaymentAmount/Value,6,0),6,1), ‘JPY’, ‘CASE_UPPER’)?>
We are calling a function by 'xdofx:to_check_number', this function reads the figures within the bracket, here we passed 'JPY' because the Japanese Yen doesn't have a decimal place (minimum unit is 1 Yen) to make the whole number an integer, then 'CASE_UPPER' just make the figure transferred word capital.
Within the check number function, we called a 'lpad' function and then passed the full path of the data we want to translate (this must be the full path from the very beginning otherwise it may not show up). Because we defined we would be using 6 digits in the check. For example, £12 should be 000012 pounds. So we are using the lpad function to make the whole number 6 digits, and any number before the actual number would be 0. This step is required because we don't know how many digits will be there so we make all of them as 6 digits.
Then we called a 'substr' function to cut and fetch the figure we wanted to read. The substr function finds the 6th letter of the string and has a length of 1 which means the very last (unit digit gets selected). Then we passed the substr value for to_check_number function to translate, we can get the unit digit word.
Similarly, for tens digit, you should pass a certain code to fetch:
<?xdofx:to_check_number(substr(lpad(OutboundPaymentInstruction/InstructionTotals/TotalPaymentAmount/Value,6,0),5,1), ‘JPY’, ‘CASE_UPPER’)?>
The lpad function remains the same but substr function this time finds the 5th letter of the string and has a length of 1. Hundreds, thousands, ten thousand digits follow the logic.
Eventually, you can put them in the rtf template and have a nice-looking box read digit output. You can adjust the positions based on your check paper.