Date Formula Issue
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Date Formula Issue

  1. #1
    Join Date
    Jun 2006
    Posts
    16

    Date Formula Issue

    Hello,
    For years I have been using the CDate({trips.tdate}) = dateadd('d',-1 ,CurrentDate ) to batch print reports automatically utilizing Crystal Delivery. There has been changes to the report so now when I utilize the same formula it takes hours to run vs a few minutes. When I pick a specific date through the select expert utilizing the {trips.tdate} field the report only takes a minute or two but when I apply to formula it grinds for hours. The "accessing database" also takes a lot longer with the formula vs just a specific date. Any thoughts or guidance would be greatly appreciated.

  2. #2
    Join Date
    Aug 2007
    Posts
    174

    Re: Date Formula Issue

    I think when you select a specific date, Crystal can "push down" the record selection formula to your database server. But, when you use the function to determine the date of interest, crystal cannot translate the record selection formula into something that can be evaluated by the DB sever. So all the records must be retrieved first and then evaluated by the computer that is running the report. This would explain why you see pretty good performance when you pick a specific date, and poor performance when you use the function.

    To overcome this, create a SQL Expression field to manipulate you dates, and then use the SQL Expression field in your record selection formula. That way, Crystal will be able to push down the entire query. If you select Database->Show SQL Query, you can see if your entire record select formula will be evaluated on the DB server, or if some parts will be evaluated locally.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)