Groff Automation Forum Index
Making software work for you
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in 

Log in to check your private messagesLog in to check your private messages   

POSSIBLE SOLUTION to "DO NOT EXPORT IF BLANK"

 
Post new topic   Reply to topic    Groff Automation Forum Index -> Feedback
View previous topic :: View next topic  
Author Message
neil111

Joined: 05 Dec 2005
Posts: 9
PostPosted: Wed Dec 14, 2005 8:25 am    Post subject: POSSIBLE SOLUTION to "DO NOT EXPORT IF BLANK" Reply with quote

Hi. I think I have a solution and would like your input. It is a different approach than trying to find out if records were returned by CR, and offers some flexibility for the user. I also believe it uses existing CD functionality so would not be too time consuming or difficult to add in the current release (but I'm not the judge of that, of course Smile.

The Proposed Solution: After exporting the file to its destination folder, check the resulting file size. In most cases, even with headers & footers, a report with no records will be very small in filesize. I just tested one of mine with a selection criteria of 1=0 (so no records were generated), and the resulting .pdf was 10.3KB.

My suggestion is to add the following options to the crystal report settings screen in the Export Prompt Section:
- Export File Size Lower Limit: ____ KB (leave blank if always export)
- Delete File if smaller than limit?: Y/N
- E-Mail address to notify of "lower limit" condition: ____________

Then, after the file is exported, have CD check the resulting file size. If the size is less than the lower limit specified by the user, then possibly delete it, and then send a notification e-mail (not to all users that are subscribed, but just to the specified recipient for this condition) indicating the report was created but that its size was too small to be distributed.

I trust that when the usual destination of the export is to e-mail to users, a "temporary file" is saved somewhere on the local hard drive before it is attached to the outbound e-mail, and this is the point where the above logic would be applied.

I welcome and look forward to any/all comments on the above from the community. Kevin, hopefully you think will work.

Thanks,
- Neil
Back to top
View user's profile Send private message
kgroff
Site Admin
Joined: 27 Jan 2005
Posts: 694
PostPosted: Wed Dec 14, 2005 3:34 pm    Post subject: Reply with quote

Something like this would be fairly easy to incorporate. I will see about adding it in the near future. Thanks.
Back to top
View user's profile Send private message
JohnW

Joined: 16 Dec 2005
Posts: 8
PostPosted: Fri Dec 16, 2005 11:01 am    Post subject: Reply with quote

Something to consider when doing a filesized based cull on your report is that timestamps will update on an empty report. This would theoretically change the filesize by a slight margin (depending on how many stamps were in a given empty report). You'd want to be sure to err on the side of larger file sizes to delete.

I recently had to tackle this problem myself. Below is my method, definately not for the sane or faint of heart.

Make a text field containing a unique phrase on your report. Set it to suppress conditionally when:
Not(Isnull(Count({dbo_Accounts.AccountID}))) or
Count({dbo_Accounts.AccountID}) > 0

The logic is that it will only show the unique phrase on an empty report.

{dbo_Accounts.AccountID} is simply a number field found in my report that does exist on a normal report, while it does not exist on an empty report. Any report field should work.

Using xpdf's tool pdftotext, I translate the first page of the output pdf file to a text file (my unique word field is on the first page), and use findstr (nifty xp command line file scanner) to search for the unique phrase.

If findstr hits, I delete the text file, and the empty pdf. Otherwise, I just delete the text file.

Ugly as sin, but it automates Smile
Back to top
View user's profile Send private message
kgroff
Site Admin
Joined: 27 Jan 2005
Posts: 694
PostPosted: Mon Dec 19, 2005 10:49 am    Post subject: Reply with quote

Finally, thanks to some input from JohnW, CD can generate an alert if a report is empty. This option is found by pressing 'Config'. The alert email now includes the parameter settings for the report the generated the alert.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Groff Automation Forum Index -> Feedback All times are GMT - 6 Hours
Page 1 of 1

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


Powered by phpBB © 2001, 2002 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron