I modified the standard Avery Label to include a textbox that contains the client's last name. In our implementation of D-Tools the client name is entered
Last Name, First Name. So I wrote a quick script that stores the name in a string then creates another string using a substring of the original name. I don't have it in front of me but the code is something like this:
|
Code:
|
Sub Detail1_Before Print
Dim lastNameFirstName As String = ""
Dim lastName As String = ""
Dim nameCommaIndex As Integer
' Get the value from a non-visible textbox on the report
lastNameFirstName = ReportUtilities.GetTextBoxValue(rpt, "Detail1", "txtdtr_DTOOLS_CompanyName")
' The next line uses the .IndexOf method of the String Class to
'identify the index of the first comma and set nameCommaIndex
'to this value. I can't remember the exact syntax but it works.
' Set lastName using substring of lastNameFirstName
lastName = lastNameFirstName.Substring(0, nameCommaIndex)
' THE PROBLEM IS IN THE LINE ABOVE
' Set the value of the calculated textbox using the lastName substring
ReportUtilities.SetTextBoxValue(rpt, "Detail1", "txt_CALC_lastName", lastName) |
Everything tests well in Report Designer and gives the desired result. I get an exception thrown error when I try to publish. If I replace the nameCommaIndex variable in the substring method parameters with a number like "5" everything works.
Are there any issues with using an integer data type?
Is the client's last name accessible directly?
I am still running SI5.5 SP1 for a few more days until I upgrade to SP3.