Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: possible to abort if no data found Post Reply Post New Topic
Author Message
carstowal
Groupie
Groupie


Joined: 31 Jul 2008
Online Status: Offline
Posts: 80
Quote carstowal Replybullet Topic: possible to abort if no data found
     Posted: 14 Dec 2010 at 4:20am
CR 2008
 
my report uses
~1 SQL based table, "EMPLOYEE"
~1 excel spreadsheet, "Table"
~1 parameter WeekEndDateAsDate
~2 formulas
  @LastDateSaturday formula says if parameter
    WeekEndDateAsDate entered is not a Sat, move out to the next Sat.
  @FirstDateSunday formula says back up to the Sunday prior to
     @LastDateSaturday
~Record Select :
{Table_.for_Wk_Ending} >= {@FirstDateSunday} and
{Table_.for_Wk_Ending} <= {@LastDateSaturday} and
not ({EMPLOYEE.DEPARTMENT_ID} in ["10A", "10B", "30D"])
 
 
this report normally takes about 5 minutes to run.
If accounting forgets to enter the data one week into the excel table and someone tries to run the report for that week, it runs and runs and runs forever and finally returns zero hours paid.
 
Is there anyway to make the report look at the excel table first and if the @LastDateSaturday is not found abort the process? 
 and maybe even give the user a message that there are no entries for that date found!


Edited by carstowal - 14 Dec 2010 at 4:26am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Dec 2010 at 4:31am
without having the report request the same parameter multiple times, it would seem that a solution would be to have a subreport in the report header run and count the number of entries that match in the Excel file and if the result is 0, skip out of the report selection criteria. You can use a shared variable to report the results from the subreport back to the main report.
 
HTH 
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