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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Length Question... 1

Status
Not open for further replies.

ChiTownDiva

Technical User
Jan 24, 2001
273
US
I'm getting the following error message:

String Length is less than 0 or not an integer

When I first wrote the report, the selection formula looked like this:

{CRSE_SESSION.LOCAL_SESSION_CD} like {?Course Session} and
{CRSE_SESSION.START_DT} in {?Start Date} to {?End Date} and
{LOOKUP_STRINGS.TTL} like {?Location}


I changed it to this:

Left({CRSE_SESSION.LOCAL_SESSION_CD},InStr({CRSE_SESSION.LOCAL_SESSION_CD},Chr(45))-1) like {?Course Session} and
{CRSE_SESSION.START_DT} in {?Start Date} to {?End Date} and
{LOOKUP_STRINGS.TTL} like {?Location}


I believe the part I have italicized is what's generating the error, but I don't know why or what it means.

Can anyone help?

Thanks in advance.

ChiTownDivaus [ponytails2]
 
It may be that chr(42), the *, isn't found in one of the records.
 
Thanks Noxum...

But I'm using chr(45) which is a dash. A dash separates every course from the session number, i.e. CB253-007. I need to compare everything left of the dash.

ChiTownDivaus [ponytails2]
 
sorry miss read my ascii table...

Have you tried putting the dash in quotes instead of the char(45) "-"?
 
Is it possible that course number can be blank or null?

Lisa
 
Put the
not( isnull({CRSE_SESSION.LOCAL_SESSION_CD}) ) and

statement in before

Left({CRSE_SESSION.LOCAL_SESSION_CD},InStr({CRSE_SESSION.LOCAL_SESSION_CD},Chr(45))-1) like {?Course Session} and
{CRSE_SESSION.START_DT} in {?Start Date} to {?End Date} and
{LOOKUP_STRINGS.TTL} like {?Location}

I've been told that the order in which you place your selection statements matters, so try filter out the null fields then process the other statements
 
How about testing the formula by adding:

if InStr({CRSE_SESSION.LOCAL_SESSION_CD},Chr(45))-1 > 0 then

Left({CRSE_SESSION.LOCAL_SESSION_CD},InStr({CRSE_SESSION.LOCAL_SESSION_CD},Chr(45))-1) like {?Course Session} and
{CRSE_SESSION.START_DT} in {?Start Date} to {?End Date} and
{LOOKUP_STRINGS.TTL} like {?Location}

If it works, then you have a course number without a "-" somewhere. Testing for nulls or blanks seems like a good idea, too.

It also might be helpful to know what you have set up for defaults for {?Course Session}.

-LB

 
these are all good suggestions...probably the null is the reason for the failure....but having said that...do you really want such a complicated formula in a record selection??

With this kinda formula your report will crawl as nothing will pass down to the server. I think it is better to grab all records quickly and then use crystal sort this out using this as a suppress criteria for sections

Jim Broadbent
 
Thanks guys for all your help...:-D

The Not ISNull() function still generated the error, so I ended up using LB's formula. Thanks LB!![2thumbsup]

ChiTownDivaus [ponytails]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top