Skip to Content
avatar image
Former Member

String length less than 0 or not an integer

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 19, 2011 at 10:56 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jun 22, 2011 at 12:37 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

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

      Many thanks,

      Balaji K