Using VSView Reporting Edition > Advanced Topics > Unbound Reports |
Unbound reports are reports without an underlying source recordset. This type of report can be useful in two situations:
You create documents that have a fixed format, and only the content of a few fields changes every time you need to render the document. Business forms are a typical example: the forms have a fixed format, and the field values change.
You want to consolidate several summary reports into a single one. In this case, you would create an unbound main report, and you would add bound subreports to it.
As an example of a simple unbound report, let's create a simple Newsletter document without a source recordset. This is done with the VSReport8 Designer, except that you leave the ConnectionString and RecordSource properties blank and add placeholder fields to the report. The placeholder fields are simple labels whose contents will be set by an application.
Assuming you created a report with six placeholder fields named "FldHeadLineXXX" and "FldBodyXXX" (where XXX ranges from 1 to 3), you could use the following Visual Basic code to render the report:
Example Title |
Copy Code
|
---|---|
Private Sub MakeNewsLetter_Click() ' load unbound report vsr.Load App.Path & "\Newsletter.xml", "Newsletter" ' set field values vsr.Fields("FldHeadline1").Text = "VSReport8 Launched" vsr.Fields("FldBody1").Text = "Text with the first headline." vsr.Fields("FldHeadline2").Text = "Competitive Upgrades" vsr.Fields("FldBody2").Text = "Text with the second headline." vsr.Fields("FldHeadline3").Text = "VSReport8 Designer" vsr.Fields("FldBody2").Text = "Text with the third headline." ' done, show the report vsr.Render vp ' and/or save it to a PDF document file so your subscribers can get to it vsr.RenderToFile "Newsletter\Latest.pdf", vsrPDF End Sub |
Here is what this issue of our newsletter looks like. Notice that our simple program does not deal with any formatting at all; it simply supplies the report contents. The report definition created with the VSReport8 Designer takes care of all the formatting, including a headline with a logo, page footers, fonts and text positioning. Separating format from content is one of the main advantages of unbound reports.
NOTE: You can also create your own custom recordset object and use it instead of a regular ADO recordset. Custom data-bound reports are described next. |