In order to use an RPX file without a DSR file, the saved report needs to be independent of any visual basic code. However, it is also very important to keep sensitive information, such as a connection string, out of the RPX file because the file is not secure. In the following example, the script generates an unbound report in much the same way as setting up a normal unbound report. The sample demonstrates how to use the AddNamedItem method to allow the script to reference a function contained within a class in the project. This allows the connection to be made inside the visual basic project, with the resulting Recordset returned to the script.
The sample unbound grouping project from chapter 6 can easily be converted to an unbound scripting sample by removing all the code from the visual basic project and adding the following code in the script editor: