cancel
Showing results for 
Search instead for 
Did you mean: 

String length less than 0 or not an integer

Former Member
0 Kudos

Folks,

I'm pretty new to CR programming. I have 2 queries.

1. The application passes 2 (start and end dates) parameters in String format to CR. I need to convert the them into date format for the database to filter and retrieve the relevant accordingly.

During execution the system errors out " String length less than 0 or not an integer".

Here's the code for processing the startdate parameter. The same logic holds good for enddate as well.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

StringVar MM := Left({@ID650},InStr({@ID650},"/") -1);

StringVar YY := Right({@ID650}, InStr({@ID650},"/") -1);

NumberVar LOFF := InStr({@ID650},"/") +1 ;

StringVar DD := Mid({@ID650},LOFF,InStr({@ID650},"/") -1);

CDate(YY+MM+DD)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

*PS -> ID650 is a form field which is accessible within CR ENV.*

2. How do I debug / trace a Crystal Reports Report execution?

I'm a little short on time. I'd appreciate an early response / resolution.

Regards,

Balaji K

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Can you get to the data at source and get it in real date format.

if not you will need to consider all cases of the ways people can enter dates

12/25/2011 ( xmax day in US)

25/12/2011 ( xmas day in UK)

25 . dec . 11 ( there are lots more formats to go)

if you have string try isdate() function ( it is also a bit hit and miss on formats)

Former Member
0 Kudos

Hi,

I used the mtocdate(tonumber) function to arrive at a consistent format and it did the job for me.

Many thanks,

Balaji K

former_member292966
Active Contributor
0 Kudos

Hi Balaji,

I think @ID650 may be empty for a record. In this case we can have it check for that like:

If {@ID650} NOTEQUAL "" Then 
    (StringVar MM := Left({@ID650},InStr({@ID650},"/") -1);
    StringVar YY := Right({@ID650}, InStr({@ID650},"/") -1);
    NumberVar LOFF := InStr({@ID650},"/") +1 ;
    StringVar DD := Mid({@ID650},LOFF,InStr({@ID650},"/") -1);
    CDate(YY+MM+DD)) 
Else "";

Replace NOTEQUAL with LessThan GreaterThan symbols.

Good Luck,

Brian

Former Member
0 Kudos

Hi Brian

Its very annoying that you can't show Not equal.

Jason Long kindly shared this code with me so I am happy to pass along

The greater than and less than symbols are &gt ; and &lt ; (just remove the spaces between t ;

Ian