Separating Data Access from Data Formatting
You can use RSSBus Simple Services to remove the data access function from the data formatting function. This can provide a number of configuration, security and reuse benefits. Here is a template that calls an RSSBus Simple Service to access a Microsoft Access database. The template accepts a personalization input that will be used to select records from a table:
Below is the toners2.rsb service definition called by the above template. RSSBus Simple Service scripts are very similar to templates, but they have an rsb:push statement instead of embedded HTML. Each execution of the push statement within the call loop sends one row of data to the output feed. Note the rsb:map statement that renames the output columns from the access: namespace (the default for accessSelect) to the toner: namespace. This further hides the source of the data from callers.<rsb:info> <input name="manufacturer" default="" /> </rsb:info> <table> <tr><th>Model #</th><th>Manufacturer</th></tr> <rsb:call op="sp://myserver/Shared%20Documents/toners2.rsb?man=[manufacturer]"> <tr><td>[toner:modelnumber]</td><td>[toner:manufacturer]</td></tr> </rsb:call> </table>
<rsb:info title="Toners Access Service"> <input name="manufacturer" default=""/> </rsb:info> <rsb:set attr="database" value="demo.mdb" /> <rsb:set attr="table" value="Toners" /> <!-- Match manufacturer if value was supplied, else return all --> <rsb:notequals attr="manufacturer" value=""> <rsb:set attr="rec:manufacturer" value="[manufacturer]" /> </rsb:notequals> <rsb:call op="accessSelect" output="out"> <rsb:map from="out" to="newout" map="toner:* = access:*"/> <rsb:push item="newout"> [ newout.* ] </rsb:push> </rsb:call>