Rank: Newbie
Groups: Registered
Joined: 11/19/2020(UTC) Posts: 3 Location: Moscow, RU
Thanks: 1 times
|
Hello colleagues, I have a report which I use like Dashboard. The report shows quantity of bad events in my internal system. If all is well the report shows: QTY of bad events = 0. In bad situation the report shows: QTY of bad events = 10 (for example). I try to set up output for the report (email or folder). Because my report always has one record (0 or not) I couldn't use the standard method Cancel generation if no records. Ok. I have written Pre-generation script when a calculate result (<>0) and set variable result to 0 or 1. But... In any cases (result=0 or result=1) my output is working and generate file or send e-mail. My code is Quote:@{ ReportOutput output = Model; string result = "0"; //Set result to 0 to cancel the report. } @Raw(result) I Execute Output and check Messages: Quote: 20:14:14 Starting execution of 'DayRegistryStatus' (No security context)... 20:14:14 Starting to build models... 20:14:14 Build models of Execution Set 1... 20:14:14 Model 'mShouldBeSend': Loading result set... 20:14:14 Model 'tShouldBeAccept': Loading result set... 20:14:14 Model 'tShouldBePay': Loading result set... 20:14:14 Model 'tShouldBePay': Executing main query... 20:14:14 Model 'tShouldBeAccept': Executing main query... 20:14:14 Model 'mShouldBeSend': Building pages... 20:14:14 Model 'mShouldBeSend': Building tables... 20:14:14 Model 'mShouldBeSend': Building totals... 20:14:14 Model 'tShouldBePay': Building pages... 20:14:14 Model 'tShouldBePay': Building tables... 20:14:14 Model 'tShouldBePay': Building totals... 20:14:14 Model 'tShouldBeAccept': Building pages... 20:14:14 Model 'tShouldBeAccept': Building tables... 20:14:14 Model 'tShouldBeAccept': Building totals... 20:14:14 Rendering report... 20:14:15 Report result generated in '\Отчет по статусам.html' 20:14:15 Processing result file for output 'output (Folder Device)' 20:14:15 Executing Pre-Execution script. 20:14:15 The script returns:0 20:14:15 Report result generated in '\Отчет по статусам.html' 20:14:15 Rendering report...
I see "The script returns:0". But the output is not stopped. Why?
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
This is a bug that will be fixed in the 6.0 (coming this week). As a workaround, you can cancel the report with the Cancel flag: Code:output.Report.Cancel = true;
but for generation in a folder, the report result file will be created anyway... Note that you can also use a task (with the Step 'Rendering is done, before output execution') to handle what you need.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/19/2020(UTC) Posts: 3 Location: Moscow, RU
Thanks: 1 times
|
Big thanks! Before your answer I used rise an error divide by zero :) int i = 0; i = 10 / Int32.Parse(result);
|
|
|
|
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.