Reply
 
LinkBack Thread Tools Display Modes
Old 01-21-2011, 05:05 PM   #1 (permalink)
Senior Member
 
Join Date: Mar 2006
Location: Novato (20 miles north of San Francisco)
Posts: 445
fryeguy is on a distinguished road
Default Calculated Value with Exception Thrown

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.
fryeguy is offline   Reply With Quote
Old 01-21-2011, 09:41 PM   #2 (permalink)
Senior Member
 
Join Date: Mar 2006
Location: Novato (20 miles north of San Francisco)
Posts: 445
fryeguy is on a distinguished road
Default

I was able to fix my code.

Using:
Code:
 
lastName = lastNameFirstName.Split(",".ToCharArray())(0)
...instead of the substring method...
fryeguy is offline   Reply With Quote
Reply

Tags
avery, exception thrown, integer, settextboxvalue, substring


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:22 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
D-Tools, Inc.