Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Length less than 0 or not an integer

Status
Not open for further replies.

glasper

Technical User
Nov 6, 2006
8
0
0
US
I'm using Crystal Reports 8.5 to remove the trim data that looks like:

MicroSwitch (oc:Stephen M. Johnson)

The formula that I'm using is:

Trim (left({CONTHIST.REF}, Instr({CONTHIST.REF},"(")-1))

The problem is that when I run the report, I get the error String Length less than 0 or not an integer. What am I doing wrong?
 
You have a null field, and then you are subtracting 1 from it. So test for nulls first:

if isnull({CONTHIST.REF}) then "" else
Trim (left({CONTHIST.REF}, Instr({CONTHIST.REF},"(")-1))


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
There might be records that do not contain "(":
Code:
If Instr({Customer.Customer Name}, "(") > 1 Then
    Trim (left({Customer.Customer Name}, Instr({Customer.Customer Name}, "(") - 1))
else
    Trim ({Customer.Customer Name})

-------------------------------------------------------------------------------------------------------------------------
"Now I can look at you in peace; I don't eat you any more." Franz Kafka, while admiring fish in an aquarium
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top