How To: Convert Dollar Amounts into Words for Cheques in Dynamics GP
This blog is part of the GP Cheque design series. Please find our past cheque design blogs below:
How to Print Cheque Date in MMDDYYYY Format
How to Add Asterisks to the Cheques Field
Background
In the GP version prior to GP2010, function RW_ConvertToWordsAndNumber() were often used to convert the cheque amounts into words. However, this function had a limit of 80 characters which returned the string truncated to 80 characters. Additional calculated field was required to word around this 80 character limits. In GP2010, a new built-in function RW_ConvertToWordsAndNumbersParse() was introduced to resolve this 80 character limit issue. In today’s blog, we will talk about how to use this function in Report Writer during your cheque design.
Function Parameters
How to Use the Function
The returned value of RW_ConvertToWordsAndNumbersParse() is a string, so to use it we need to add a new calculated string field
- In Report Writer, Tool Box – Add a new Calculated Field – Result Type : String – give the new calculated field a name e.g. Amount_To_Words
- Under Functions Tab – User-Defined – Core: System – Function – RW_ConvertToWordsAndNumbersParse() – Add
- Complete the Expressions by adding the amount field and other parameters e.g. like below
FUNCTION_SCRIPT( RW_ConvertToWordsAndNumbersParse Check_Total “” 0 160 1)
a. The above function used 0 as the mode parameter which converts the check total dollar amounts, the whole dollars into words, cents in numbers with only printing out the total of 160 characters in one line, e.g. like below
b. If we change the mode to 1, it will print both whole dollars and cents in number, e.g. like below
FUNCTION_SCRIPT( RW_ConvertToWordsAndNumbersParse Check_Total “” 1 160 1)
c. Or if we replace the mode number with number 2, it will convert both whole dollars and cents into words, e.g. like below
FUNCTION_SCRIPT( RW_ConvertToWordsAndNumbersParse Check_Total “” 2 160 1)
If the space on your physical cheque doesn’t allow you to print 160 characters in one line, try to break it into two lines by printing the first 80 characters in the 1st line and the rest 80 characters in the 2nd The two calculated fields are like below
Calculated field 1 – Amount_To_Wors_1
FUNCTION_SCRIPT( RW_ConvertToWordsAndNumbersParse Check_Total “” 0 80 1)
Calculated field 1 – Amount_To_Wors_2
FUNCTION_SCRIPT( RW_ConvertToWordsAndNumbersParse Check_Total “” 0 80 2)
NOTE – If you need to make these fields print out dynamically, e.g. if the whole string is less than 80 characters, then the 2nd line is not required. Conditional calculated field and additional functions need to be used. The topic will be covered in an upcoming blog post, so stay tuned!
I hope that this how-to post was helpful in getting your cheques formatted correctly. If you have any questions or suggestions for future blogs, please reach out to [email protected].