Sample below provides a solution for converting dollars and cents currency value into words using VBA/Modifier to overcome the 80 character limit on string calculated fields. The solution combines two ideas owned by David Musgrave (Australia) Microsoft Dynamics GP Asia Pacific support team Escalation Engineer.
<Component Name="Check With Stub on Top" ProductId="0" Object="VBAReport" >
VBAReport "Check With Stub on Top"
{
Code "Option Explicit
Const MaxLines As Integer = 3
Const MaxChars As Integer = 50 ' Cannot be longer than 80
Private Sub Report_BeforeAF(ByVal Level As Integer, SuppressBand As Boolean)
Dim PrintCollection As DUOSObjects
Dim PrintObject As DUOSObject
'Dim CompilerApp As New Dynamics.Application
Dim CompilerApp As Object
Dim CompilerMessage As String
Dim CompilerError As Integer
Dim Commands As String
' Create link without having reference marked
Set CompilerApp = CreateObject(\"Dynamics.Application\")
Select Case Level
Case 1
Set PrintCollection = DUOSObjectsGet(\"Cheque Printing\")
Set PrintObject = PrintCollection.Item(Trim(CStr(DocumentNumberLASTF1)))
PrintObject.Properties(\"String 1\") = \"\"
PrintObject.Properties(\"String 2\") = \"\"
PrintObject.Properties(\"String 3\") = \"\"
Commands = \"\"
Commands = Commands & \"local currency l_dollarpart; \" & vbCrLf
Commands = Commands & \"local currency l_centpart; \" & vbCrLf
Commands = Commands & \"local string l_dollarwords; \" & vbCrLf
Commands = Commands & \"local string l_centwords; \" & vbCrLf
Commands = Commands & \"local string l_dollarwordsonly; \" & vbCrLf
Commands = Commands & \"local integer l_centwordslen; \" & vbCrLf
Commands = Commands & \"local string l_centwordsonly; \" & vbCrLf
Commands = Commands & \"local string l_centwordstrim; \" & vbCrLf
Commands = Commands & \"local integer l_rightwordmark; \" & vbCrLf
Commands = Commands & \"local integer l_rightwordstart; \" & vbCrLf
Commands = Commands & \"local string l_rightword; \" & vbCrLf
Commands = Commands & \"local string l_getresult; \" & vbCrLf
Commands = Commands & \"local string l_strings[3]; \" & vbCrLf
Commands = Commands & \"local integer i; \" & vbCrLf
Commands = Commands & \"l_dollarpart = RW_Truncate(\" & CCur(CheckTotalLASTF1) & \",0,0); \" & vbCrLf
Commands = Commands & \"l_centpart = (\" & CCur(CheckTotalLASTF1) & \" - l_dollarpart) * 100.00000 ; \" & vbCrLf
Commands = Commands & \"l_dollarwords = RW_ConvertToWordsAndNumbers(((l_dollarpart)), \"\"\" & Trim(CStr(CurrencyIDLASTF1)) & \"\"\",0); \" & vbCrLf
Commands = Commands & \"l_centwords = RW_ConvertToWordsAndNumbers(((l_centpart)), \"\"_\"\",0); \" & vbCrLf
Commands = Commands & \"l_centwordslen = RW_Length((l_centwords))- 4; \" & vbCrLf
Commands = Commands & \"l_centwordsonly = RW_Left((l_centwords), l_centwordslen); \" & vbCrLf
Commands = Commands & \"l_centwordstrim = RW_Trim((l_centwordsonly), 3,\"\" \"\"); \" & vbCrLf
Commands = Commands & \"l_rightwordmark = RW_Pos((l_dollarwords) ,\"\"00\"\",1) - 1; \" & vbCrLf
Commands = Commands & \"l_rightwordstart = ((l_rightwordmark)) + 3; \" & vbCrLf
Commands = Commands & \"l_rightword = RW_Substring((l_dollarwords) ,(l_rightwordstart),20); \" & vbCrLf
Commands = Commands & \"l_dollarwordsonly = RW_Left((l_dollarwords),(l_rightwordmark)); \" & vbCrLf
Commands = Commands & \"l_getresult = (l_dollarwordsonly) + (l_centwordstrim) + (l_rightword) ; \" & vbCrLf
Commands = Commands & \"for i = 1 to \" & Str(MaxLines) & \" do \" & vbCrLf
Commands = Commands & \" l_strings[i] = RW_ParseString(l_getresult, \" & Str(MaxChars) & \", i); \" & vbCrLf
Commands = Commands & \" clear table SY_User_Object_Store; \" & vbCrLf
Commands = Commands & \" 'ObjectType' of table SY_User_Object_Store = \"\"Cheque Printing\"\"; \" & vbCrLf
Commands = Commands & \" 'ObjectID' of table SY_User_Object_Store = \"\"\" & Trim(CStr(DocumentNumberLASTF1)) & \"\"\"; \" & vbCrLf
Commands = Commands & \" 'PropertyName' of table SY_User_Object_Store = \"\"String \"\" + str(i); \" & vbCrLf
Commands = Commands & \" change table SY_User_Object_Store; \" & vbCrLf
Commands = Commands & \" if err() <> MISSING then \" & vbCrLf
Commands = Commands & \" 'PropertyValue' of table SY_User_Object_Store = l_strings[i]; \" & vbCrLf
Commands = Commands & \" save table SY_User_Object_Store; \" & vbCrLf
Commands = Commands & \" check error; \" & vbCrLf
Commands = Commands & \" else \" & vbCrLf
Commands = Commands & \" release table SY_User_Object_Store; \" & vbCrLf
Commands = Commands & \" end if; \" & vbCrLf
Commands = Commands & \"end for; \" & vbCrLf
' Execute SanScript
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
If CompilerError <> 0 Then
MsgBox CompilerMessage
Else
Set PrintCollection = DUOSObjectsGet(\"Cheque Printing\")
Set PrintObject = PrintCollection.Item(Trim(CStr(DocumentNumberLASTF1)))
String1LASTF1 = CStr(PrintObject.Properties(\"String 1\"))
String2LASTF1 = CStr(PrintObject.Properties(\"String 2\"))
String3LASTF1 = CStr(PrintObject.Properties(\"String 3\"))
End If
Set PrintCollection = DUOSObjectsGet(\"Cheque Printing\")
PrintCollection.Remove (Trim(CStr(DocumentNumberLASTF1)))
Case Else
End Select
End Sub
"
EventMode "1"
Fields
{
ReportField "CheckTotalLASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "Check Total"
TableName "PM_Payment_WORK"
}
ReportField "CurrencyIDLASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "Currency ID"
TableName "PM_Payment_WORK"
}
ReportField "DocumentNumberLASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "Document Number"
TableName "PM_Payment_WORK"
}
ReportField "String1LASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "String 1"
TableName ""
}
ReportField "String2LASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "String 2"
TableName ""
}
ReportField "String3LASTF1"
{
AccumulatorType "11"
ArrayIndex "0"
BandLevel "1"
BandType "4"
FieldName "String 3"
TableName ""
}
}
Name "CheckWithStubonTop"
}
</Component>
Someone should find this useful. skype id is danielduodupoku