Microsoft Dynamics GP Developing for Dynamics GP
A blog dedicated to the Microsoft Dynamics GP Developer & Consultant community
 
Welcome to MSDN Blogs Sign in | Join | Help

Developing for Dynamics GP

by David Musgrave (Australia) and the Microsoft Dynamics GP Developer Support Team (USA)

News

  • Please use the Blog Feedback? - Contact Us link at the top of the page to email questions relating to the blog itself.

    If you wish to ask a technical question, please use the links below to ask on the Newsgroups. If you ask on the Newsgroups, others in the community can respond and the answers are available for everyone in the future.

    Please do not use comments on pages and posts to ask questions unrelated to the topic on that page or post.



    Dates of Interest:

    11-Jul-2008: Blog Created by David Musgrave.
    10-Oct-2008: First Post by Scott Stephenson.
    04-Nov-2008: First Post by Dave Dusek.
    11-Nov-2008: First Post by Beth Gardner.
    28-Nov-2008: First Post by Chris Roehrich.
    30-Dec-2008: First Post by Patrick Roth.
    24-Feb-2009: First Post by Greg Willson.
    22-Apr-2009: First Post by David Clauson.
    04-May-2009: First Post by Ryan Wigestrand.
    19-Jun-2009: First Post by Dawn Langlie.
    03-Jul-2009: First Post by Emily Halvorson.



    WorldMaps Statistics since
    24-Feb-2009:






    Translator Tool:




    Disclaimer

    This blog is provided "AS IS" with no warranties, and confers no rights.

    The links in this blog may lead to third-party Web sites. Microsoft provides third-party resources to help you find customer service and/or technical support resources. Information at these sites may change without notice. Microsoft is not responsible for the content at any third-party Web sites and does not guarantee the accuracy of third-party information.

Contents

Favourite Posts

Blog Links

Newsgroups Links

Resources Links

Hybrid - Cheque Amount in Words Example

One of the Report Writer functions added to v7.00 onwards (see Using the built-in Report Writer Functions) was the RW_ConvertToWordsAndNumbers() function to convert a currency amount into words.  After the code was added, it was realised that Report Writer calculated fields of return type string are limited to 80 characters.  This means that if your amount in words is longer than 80 characters, only the first 80 characters will be returned and the rest will be truncated and lost.

This example using the "Check with Stub on Top" report was created to provide a method of using Visual Basic for Applications (VBA) to overcome this 80 character limitation.  The code uses the Continuum Integration Library to execute Dexterity sanScript code and also uses the Dynamic User Object Store (DUOS) to allow the Dexterity code to return its results to VBA. The DUOS is used because the DUOS table (SY90000) is easily visible to Dexterity as the SY_User_Object_Store table and to VBA as the DUOS objects.

The VBA code creates a Collection and creates 3 blank DUOS records to store 3 string properties. Then the code uses pass through Dexterity to call the RW_ConvertToWordsAndNumbers() function and then uses the RW_ParseString() function to split the returned result into 3 lines of 50 characters which are then stored into the SY_User_Object_Store table.  When the code returns to VBA, it reads the DUOS records and displays the results to the report and finally removes the records in the DUOS.

NOTE: This customisation uses a method of executing Dexterity sanScript code from VBA which is unsupported by Microsoft.

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.

Posted: Monday, September 29, 2008 10:02 PM by David Musgrave
Attachment(s): Cheque Amount in Words Example.zip

Comments

cftung said:

Recently, our customer complain the vendor check name is too long and not able to fix into the check.

We have created 2 textbox at the check. We use VBA to measure the vendor check name length. If it is too long, we move the remaining name into 2nd text box.

But, when user print the report directly to the printer without viewing. The VBA code is not execute. On the other hand, the VBA code will execute when user viewing the report then only print the report. We are using Check with Stub on Top.

May i know is it the VBA only execute when viewing the report?

# September 30, 2008 1:17 PM

Developing for Dynamics GP said:

Most people are aware that you can use Visual Basic for Applications (VBA) with Microsoft Dynamics GP

# October 30, 2008 2:21 AM

sundaepeach said:

hi,

in what part of the vba code where I can add asterisks before and after the amount in words so that it would look like this "**One thousand dollars only**"

# November 5, 2008 3:18 AM

David Musgrave said:

The VBA code uses 3 lines to return the amount in words to the report.  If you want asterisks only at the beginning and end you will need to check if the second or third line is used before adding the asterisks:

If Trim(PrintObject.Properties("String 2")) = "" Then
   String1LASTF1 = "**" + CStr(PrintObject.Properties("String 1")) + "**"
   String2LASTF1 = ""
   String3LASTF1 = ""
ElseIf Trim(PrintObject.Properties("String 3")) = "" Then
   String1LASTF1 = "**" + CStr(PrintObject.Properties("String 1"))
   String2LASTF1 = CStr(PrintObject.Properties("String 2")) + "**"
   String3LASTF1 = ""
Else
   String1LASTF1 = "**" + CStr(PrintObject.Properties("String 1"))
   String2LASTF1 = CStr(PrintObject.Properties("String 2"))
   String3LASTF1 = CStr(PrintObject.Properties("String 3")) + "**"
End If

If you want asterisks on each line, try this:

String1LASTF1 = "**" + CStr(PrintObject.Properties("String 1")) + "**"
String2LASTF1 = "**" + CStr(PrintObject.Properties("String 2")) + "**"
String3LASTF1 = "**" + CStr(PrintObject.Properties("String 3")) + "**"

David

# November 5, 2008 3:41 AM

sundaepeach said:

hi. thanks for the info. it's already working... :-)

# November 6, 2008 2:51 AM

Mohammad R. Daoud said:

By David Musgrave One of the Report Writer functions added to v7.00 onwards (see Using the built-in Report

# November 30, 2008 10:46 AM

Developing for Dynamics GP said:

I recently had a support case where the partner consultant was trying to use the RW_ConvertToWordsAndNumbers

# May 5, 2009 9:48 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker