Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I force a report to fail conditionally ?

Status
Not open for further replies.

Siggy19

Technical User
Jan 6, 2003
141
US
I am using Seagate Info to schedule a report to let me know the status of our Reporting Database.

This is updated using logshipping every half hour, although it occasionally misses a single update.

Therefore, I want the report to check how long it has been since the last update and, if that number is greater than 70 minutes, I want the report to FAIL. If it is under 70 minutes, the report should succeed.

The benefit of this is that Seagate Info has a "notification" option which will allow me to send an email to my pager ONLY if the report fails.

Any ideas on a way to conditionally force a Crystal Report written in 8.5 and running on Seagate Info 7.5 to Fail ?


 
One way might be to create a string (char) field in the database that you use the cdate function against in CR, and change the format of the string.

Hope this helps.

-k
 
Thank you, it does...

I have added a field to the query which is a string (called "ForceFailure") and has the value 'Force Failure'.

In a formula field, I have the following code;

if {orders.TimeDifference} < 70 then {orders.CurrentTime} else cdatetime({orders.ForceFailure})

The result is that if the time difference is less than 70 minutes, it will return a nice valid datetime value. If it is 70 minutes or more, it will try to convert the string 'Force Failure' into a datetime format. And fail.

Thank you !



 
Whoops... it was SynapseVampire. He signs as &quot;K&quot; and for some reason I got it into my head... oh well, I'm a klutz.

Thank you SynapseVampire !
 
Crystal stops if you do a &quot;divide by zero&quot;. Create such a case in a formula field, and invoke it when you want to stop your report.

Madawc Williams
East Anglia, Great Britain
 
I would advise very strongly against an intentional divide-by-zero situation. I have had my system go off of the deep end when this has happened.

I have seen the RptAgent hang, die, or in extreme cases start using great amounts of CPU time. It has also sent the CIAgent off into similar problems, and in truely bad cases, even my APS has gone off the deep end.

Having stated all of the above the usual situation is that the report fails, a RptAgent hangs, and one of the possible processing slots is locked up.
 
I've been using the &quot;invalid date format conversion&quot; approach for the last week and it has (so far) worked fine with no apparant ill-effects on the machine it runs on (which is running 24/7).

I am actually using the reverse of what I described above so that it fails if the data is good and succeeds if the data is bad. This way, it provides the report when there is something to look at. However, it also means that it has been failing 4 times every hour for the last week and I would have expected problems to show up by now if there were going to be any.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top