on 06-19-2011 3:39 PM
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
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.