Print Page | Close Window

Error: string length is less than 0....

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4274
Printed Date: 26 Apr 2024 at 11:07pm


Topic: Error: string length is less than 0....
Posted By: MiKeZZa
Subject: Error: string length is less than 0....
Date Posted: 17 Sep 2008 at 1:26am
My formula give's an error:

string length is less than 0 or no number (this is translated so it can be not the exact English error.

This error is given when I run a report, if I check the formula and his syntax it's ok. But when I want to display a print preview I get that error.

The formula is called add_formula1# and the code is:

Mid({@formula1#},1,(InStr({@formula1#},":")  ))



Wo can help me solving this problem?



Replies:
Posted By: Savan
Date Posted: 17 Sep 2008 at 3:51am
check the length of formula1 before doing the calculation like
 
if length(trim(@formula1#)) > 0 then
  Mid({@formula1#},1,(InStr({@formula1#},":")  )) ;


-------------
Thanks
Savan


Posted By: MiKeZZa
Date Posted: 17 Sep 2008 at 4:32am
Works fine!

thanx


Posted By: Leti
Date Posted: 19 Oct 2015 at 2:53am
Hello everybody,

I need someone's help.
I have the same error.

I have a field which is number but combine with string - (lets say "500 km" for example).
I need to remove the 'km' part of it and to stay only number - 500.

This happen with:
tonumber (mid ({Command.string_field},1,(INSTR({Command.string_field}, "km")-1)))

But when i try to export it in pdf it gives me this error message - "string length is less than 0 or not an integer". I already the previous suggestion to the problem but it's not working to men.

Any other ideas??



Print Page | Close Window