WhizBase SubReports

Due to its simplicity and unique way of working with databases, single WBSP file can work with single recordset regardless of recordsets complexity. However, in most real-life situations  there is the need for using more than one recordset for a single task (in a single wbsp file). For that purpose  WhizBase uses subreports - a report that is inserted in another report. When you combine two or more reports, one of them must serve as the main report (main WBSP file).
To include subreport in main WBSP file use either $WBSR or $WBSRQ functions. Although subreport file looks very similar to ordinary WBSP file, there are few differences:

Subreports recordset can, but does not have to,  be related to the data in the main report. For example, you can use the main report to list publishers and subreport to list titles published by them.

This is the code for main WBSP file (subreport line is marked red):
[FormFields]
WB_basename=biblio.mdb
wb_rcdset=publishers
WB_Command=Q
wb_showlogo=F
wb_order=name
<!--WB_BeginTemplate-->
<html>
<head>
<title>Publishers</title>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--WB_BeginDetail-->
<span style="font-family:Verdana;font-size:14px;font-weight:bold;color:#0066cc;">$wbf[Name]</span><br>
$wbsr[titles.sr]<br>
<!--WB_EndDetail-->
</body>
</html>

The code for subreport file (titles.sr) looks like this (line that connects two recordsets is marked blue):
[FormFields]
WB_basename=biblio.mdb
wb_rcdset=titles
wb_query=PubID=$wbf[PubID]
wb_order=[Year published]
<!--WB_BeginTemplate-->
<html>
<head>
<title>Titles</title>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--WB_BeginDetail-->
<span style="font-family:Verdana;font-size:11px;">$wbf[Year published]-$wbf[title] <strong>(ISBN:$wbf[ISBN])</strong></span><br>
<!--WB_EndDetail-->
</body>
</html>

The resulting page would look something like this:
Addison-Wesley Pub Co
1996-Real World FreeHand 5.0/5.5 (ISBN:0201883600)

Apress
2001-C# and the .NET Platform (ISBN:1893115593)

McGraw-Hill Professional Publishing
1996-Windows Nt Security Handbook (ISBN:0078822408)
1998-Microsoft Internet Information Server 4: the Complete Reference (ISBN:0078824575)
2000-Microsoft SMS Installer (ISBN:0072124474)
2001-McGraw-Hill's Encyclopedia of Networking & Telecommunications (ISBN:0072120053)

NAPP Publishing, Inc.
2000-Photoshop 6 Down and Dirty Tricks (ISBN:0967985307)

New Riders Publishing
2001-Photoshop 6 Photo-Retouching Secrets (ISBN:0735711461)

Osborne McGraw-Hill
2001-Windows 2000 Iis 5.0 : A Beginner's Guide (ISBN:0072133724)

Peachpit Press
1996-Netscape 3 for Macintosh Visual Quickstart Guide (ISBN:0201694085)
1997-Kai's Power Tools 3 for Windows Visual Quickstart Guide (ISBN:0201696681)
1997-Real World Freehand 7 (ISBN:0201688875)
1999-Non-Designer's Scan and Print Book, The (ISBN:0201353946)
2000-InDesign 1.0/1.5 for Macintosh and Windows: Visual QuickStart Guide (ISBN:0201710366)
2000-HTML 4 for the World Wide Web: Visual Quickstart Guide (ISBN:0201354934)
2000-Real World Adobe InDesign 1.5 (ISBN:0201354780)
2001-Macromedia FreeHand 10 for Windows and Macintosh: Visual QuickStart Guide (ISBN:0201749653)
2001-Fireworks 4 for Windows and Macintosh Visual Quickstart Guide (ISBN:0201731339)

Sams
2000-Sams Teach Yourself Macromedia Dreamweaver 4 in 24 Hours (ISBN:0672320428)
2000-Sams Teach Yourself Macromedia Dreamweaver 3 in 24 Hours (ISBN:0672318830)

The Coriolis Group
1999-Apache Server for Windows Little Black Book: The Indispensable Guide to Day-to-Day Apache Server Tips and Techniques (ISBN:1576103919)

Watson-Guptill Pubns
2000-www.type: Effective Typographic Design for the World Wide Web (ISBN:0823058603)
2000-www.color (ISBN:0823058573)
2001-Www.Layout : Effective Design and Layout for the World Wide Web (ISBN:0823058581)

Wordware Publishing
2000-Developer's Workshop to COM and ATL 3.0 (ISBN:1556227043)

Wrox Press Inc.
1997-Beginning C (ISBN:1861001142)
1998-Beginning Visual C++ 6 (ISBN:186100088X)
1999-Beginning Java 2 (ISBN:1861002238)

In this example main report uses table "Publishers" to list publishers in detail section and then uses subreport to show titles published by current publisher. Unique identification for every record in table "Publishers" is field PubID. In table "Titles" publisher is identified with field PubID (also in every record). Setting WB_Query to this value will generate subreport for every record in table "Publishers" and every subreport will contain only those records from table "Titles" where PubID field has the same value as PubID field of publishers recordset.
Subreport files can have any extension you want. The .sr extension in the example is used to separate subreport from main WBSP file.

For security reasons it is good policy to name subreport files with extension .sr. It is because WBSP server-side configuration variable HideDocuments in default value include .sr extension, which means that WBSP will return HTTP error 404 (File not found) whenever someone tries to execute any .sr file directly (e.g. by typing its URL in browsers address bar).