| Author |
Message |
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Topic: selection fomula date issues Posted: 27 Aug 2015 at 4:09am |
|
Hello,
I've been modifying a report with some extra checks in the record selection formula.
This works fine when running it in Crystal Reports XI.
But when I run it from in the program where this extra report has been added to it's always gives the error that a date/time is expected.
The program uses a Business Objects plugin.
The formula that works fine in CR is listed below.
schoolyear can be something like "2015-2016" and the date "2015-8-28" I even added code to be sure it ends up at yyyy-MM-dd for the mssql query.
Any help/hint would be appreciated.
Thanks in advance!
{vPackages.schoolyear} = {?p_schoolyear}
// from here is the new code
and
(
( {vPackages.startdate1} < totext( {?p_month} , "yyyy-MM-dd" ) and ( isnull ( {vPackages.enddate1} ) or {vPackages.enddate1} > totext( {?p_month} , "yyyy-MM-dd" ) )
or
{vPackages.startdate2} < totext( {?p_month} , "yyyy-MM-dd" ) and ( isnull ( {vPackages.enddate2} ) or {vPackages.enddate2} > totext( {?p_month} , "yyyy-MM-dd" ) )
)
)
|
IP Logged |
|
|
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 27 Aug 2015 at 7:11am |
|
What is the datatype of date fields you're using from vPackages? If it's a DateTime field, you can't compare it to a Date or a String.
If the field is a DateTime and the parameter is a Date, have you tried just comparing it to {?p_month} instead of converting {?p_month} to a string? If that doesn't work, I would use the DateTime() function to convert it:
DateTime({?p_month})
-Dell
|
|
|
IP Logged |
|
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Posted: 27 Aug 2015 at 8:22am |
|
In the original table those fields are of the smalldatetime type.
As the query takes some time I use a job to fill another table every hours or so, there it is plain date (not datetime or smalldatetime) and the data is correct inthere.
Any idea why it works fine in CR11 and not when used via a BO CR viewer?
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 27 Aug 2015 at 8:28am |
|
Are you using the SDK to show the report? If so, what version of Visual Studio and what version of the SDK? Also, if this is a web viewer, what browser version? If not web and not SDK, what version of the Viewer are you using?
-Dell
|
|
|
IP Logged |
|
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Posted: 27 Aug 2015 at 8:31am |
|
Good question.
This is a program from an external company and it might be a VB6 app as it doesn't require any .NET framework to get it working.
I'll ask the company about this.
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 27 Aug 2015 at 8:37am |
|
If there's no .NET framework required and the program is not written in Java, then you might be running into a limitation of using an older SDK with a new browser.
In any case, you need to contact the provider of that software for assistance. We have no way of knowing how they implemented the SDK, so there's no way to troubleshoot this with you.
-Dell
|
|
|
IP Logged |
|
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Posted: 27 Aug 2015 at 8:40am |
|
what has the browser to do with it?
It's opening like a reporting report in a .NET program not in a webview/browser.
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 27 Aug 2015 at 8:42am |
|
I assumed web. If it's a Windows app, the version of Windows you're using may also affect how it works - the older versions of the SDK don't work as well with newer operating systems.
-Dell
|
|
|
IP Logged |
|
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Posted: 27 Aug 2015 at 8:44am |
|
I'm using 8.1 and I first noticed the problem when showing the modded report at an enduser on his Vista or 7 box.
I'll give that company a call tomorrow as it's almost 21:00 here.
I'll keep you posted.
|
IP Logged |
|
geeveebee
Newbie
Joined: 03 Jul 2014
Online Status: Offline
Posts: 8
|

Posted: 27 Aug 2015 at 9:34am |
ok, I got it working  apparently that scheduled job caused to make a string out of the smalldatetime altho the destination field was a date field. (that explains the "string value expected" errors I got when I started on the formula) when I changed that to smalldatetime and re-ran the job it works fine in CR and the BO CR viewer aswell with small tweaks in the formula. I can now use the normal method as shown below {vPackages.mutdatb1} < {?p_month} and the viewer seems to auto translate the visual date in dd/MM/yyyy to yyyy-MM-dd so that less sorrows aswell.
|
IP Logged |
|
|
|