Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Switching Crystal Report from Pervasive to SQL Post Reply Post New Topic
Author Message
mbrayco
Newbie
Newbie


Joined: 17 Apr 2012
Online Status: Offline
Posts: 13
Quote mbrayco Replybullet Topic: Switching Crystal Report from Pervasive to SQL
     Posted: 13 Jun 2012 at 7:53am
I have several Crystal Reports that were created many years ago to gather data on the sales performance of our company's sales staff. At the time, the data for these reports was housed in a Pervasive v8 database (with DDFs) and entered using MAX 3.7 and later 4.0. These reports fell into disuse, and since they were last used (some four years ago), our company has switched to an MSSQL database, with MAX 5.0. Whenever these reports are run now, Crystal Reports keeps trying to install the Crystal XI RDC software, even though it is already installed. A reboot is then requested. This happense with anyone who tries to run these reports, regardless of operating system, and all company users have access to the correct database. I've opened one report and updated the table names from the old Pervasive database with the DDF tables to the new MSSQL databse. However, there were some DDF tables in the older database for which I was unable to find links to the new database. The only problem still remaining, at least that I can find to date, is that there are two custom date parameters, where the user running the report must enter starting and ending dates for the time frame over which they want to evaluate the salesperson's performance. When I go to run the report, after entering the desired start and end dates, I get a message saying "A string is required here."
Here is the text of the parameters in question (with the problem parameters in bold type):

{Invoice_Master.INVDTE_31} in {?Start} to {?Stop} and
{Part_Master.ACTTYP_01} = "F" and
{Customer_Master.CUSTID_23} in ["WES728", "MUE050", "LCW164", "HIG127", "HAR615", "FPE035", "FOL340", "ESS580", "DOR146", "CLE230", "CHE035", "BRO010"]

Looking into the matter further, I found that the data type for the Invoice_Master.INVDTE_31 field was a string, but that the parameters that request the start and end dates were dates.  I therefore changed those parameters to strings. I don't expect issues with formatting since the user is prompted to enter the dates in the proper format when the report is run. Another message came up afterward, though (text follows below):

(Popup Window) "A date is required here"
(Error Text) if month ({Invoice_Detail.INVDTE_32}) = 1 then(@ExtSalesDol) else 0

The ExtSalesDol mentioned above is a custom parameter as follows:
if {Invoice_Master.STYPE_31} = 'CR' THEN {Invoice_Detail.INVQTY_32} * -1 * {Invoice_Detail.PRICE_32} else
{Invoice_Detail.INVQTY_32} * {Invoice_Detail.PRICE_32}

Other than converting the Invoice_Master.INVDTE_31 and possibly the Invoice_Detail.INVDTE_32 fields to dates, are there any other possible options?
 
I'm not sure if the problem is with those parameters or if the report is still looking for data from the old database, or something else entirely. Any thoughts would be greatly appreciated.

Thanks in advance. 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jun 2012 at 8:28am

I would leave the params as dates and then use

date({Invoice_Master.INVDTE_31}) in your formulas and select statement.
if it chokes on invalida strings you will have to include
isdate({Invoice_Master.INVDTE_31}) and date({Invoice_Master.INVDTE_31})
IP IP Logged
mbrayco
Newbie
Newbie


Joined: 17 Apr 2012
Online Status: Offline
Posts: 13
Quote mbrayco Replybullet Posted: 14 Jun 2012 at 5:11am
Thanks for your reply.
 
I tried your suggestion, but ran into another snag.
 
The second error message I originally posted turned out to be not for the start and stop date parameters.  This message -
 
if month ({Invoice_Detail.INVDTE_32}) = 1 then(@ExtSalesDol) else 0
 
refers to a custom formula field called ONE, one of twelve such formulas that appears to look for records based on the month in the INVDTE_32 field, one per month.  I tried modifying the criteria based on your earlier suggestion to the following:
 
if month (date({Invoice_Detail.INVDTE_32})) = 1 then (@ExtSalesDol) else 0
 
I used a similar syntax for each of the formula fields ONE through TWELVE.  Evidently Crystal doesn't like that, as the Formula Editor pops up for the ONE formula with a "Bad date format string" message. 
 
Any suggestions?
 
Thanks again for your help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jun 2012 at 5:29am
you need to check your data to see if the text field can be converted to date or if you have 'bad' strings.
If all rows are 'bad' then you just need to describe the fomrat to decide how to get them to a date type. If just a re few rows are bad you have to decide if you want to just throw out the rows, clean up your source data or some other action.
to check you can use isdate(field). It will return a true or false per row.
true means you can use the date() on it with no error in the conversion, false means you cannot and you will get the bad format error.
It is up to you how you want to handle the bad rows...
IP IP Logged
mbrayco
Newbie
Newbie


Joined: 17 Apr 2012
Online Status: Offline
Posts: 13
Quote mbrayco Replybullet Posted: 14 Jun 2012 at 9:51am
Thanks again for the reply.
 
I browsed through the data on Invoice_Detail.INVDTE_32 and Invoice_Master.INVDTE_31 fields. The entries are all formatted as follows:
 
YYYY/MM/DD HH:MM:SS
 
Where the time values all default to midnight.  The difference between that format and the one specified in the parameter fields is that the parameters ask for the dates to be entered as YYYY-MM-DD, with no time specified.
 
I'll admit my Crystal knowledge is pretty limited, and I'm having trouble getting the isdate function to work.  Could it be as simple as resetting the parameters to ask for the start and end dates in the same format as the data is shown?  I did look online regarding the IsDate function and found the CDate function to convert strings to dates, but my syntax doesn't seem to be right (I keep getting prompted for numbers, values, booleans or strings to be entered where the formula name is.
 
Thanks again for your help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jun 2012 at 10:08am
crystal does have 3 field types ( date / time / datetime ) however it should not matter in this case between the datetime or date options.
 
it only takes one bad formatt (or non-existent calendar day) to error out a conversion formula.
for your select statement did you include the isdate() to filter out records that could not be converted? This should tell you if it is really only soem bad data rows that are killing the report...
 
(isdate({Invoice_Master.INVDTE_31}) and date({Invoice_Master.INVDTE_31}) in {?Start} to {?Stop}) and
{Part_Master.ACTTYP_01} = "F" and
{Customer_Master.CUSTID_23} in ["WES728", "MUE050", "LCW164", "HIG127", "HAR615", "FPE035", "FOL340", "ESS580", "DOR146", "CLE230", "CHE035", "BRO010"]
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum