Report.AbortTemplae Method
The AbortTemplate method is very similar to AbortPage
by interrupting the generation of the current HTML page and skipping to the next
template in the
report skin configuration. If the template does not have an associated
collection ("For"
attribute), this method is identical to
AbortPage .
The AbortTemplate method does not not display any errors for the
user. To display an error for the user, use the method
LogError .
Usage:
You may use the AbortTemplate method if you encounter a
minor error and do not want further processing of the template (collection). For
instance, you may want to use a third party tool to create thumbnails, and the
tool failed to load. As a result, you would abort the template "thumbnail.htm"
and let the report generator generate the rest of the report.
Report.AbortTemplate
Example:
This is an example of using the AbortPage to generate a report
page for deceased individuals only.
Dim oThumbnailCreator
oThumbnailCreator = Session("oThumbnailCreator")
If Not IsObject(oThumbnailCreator) Then
oThumbnailCreator = CreateObject("MyObjects.ThumbnailCreator")
If Not IsObject(oThumbnailCreator) Then
Report.LogError "Unable to load the Thumbnail Creator component"
Report.AbortTemplate
End If
Session("oThumbnailCreator") = oThumbnailCreator
End If
In this example, the script engine will return the runtime error
800A01AD (ActiveX component can't create object: 'MyObjects.ThumbnailCreator')
because the component MyObjects.ThumbnailCreator is fictitious. The
goal of this example was to provide a context where the AbortTemplate
method may be used.You can use both AbortPage and
AbortTemplate
methods to create fancy reports. For instance, if you want to display two
picture albums, you may have the following skin configuration:
<ReportGenerator>
<Report Template="PictureAlbum.htm" OutputFile="Album1/{id}.htm" For="Pictures" />
<Report Template="PictureAlbum.htm" OutputFile="Album2/{id}.htm" For="Pictures" />
</ReportGenerator>
At first, it may appear the folders "Album1" and "Album2" may
contain the same picture album, however using a combination of AbortPage
and AbortTemplate methods may produce two different picture albums.
See Also:
AbortPage
AbortReport
LogError
|