Using Templates with ScoutPalDB

ScoutPalDB will use an “HTM” (“Hypertext Markup”) file named “spdbtemplate” as its formatting template if that file exists in the same location as the database files.  (For most users, the database files are stored on the card in a folder named SPDB2.  In any case, the database folder has a large 100mb+ book database file named "spdb".) If an existing template file is deleted from the database storage folder, ScoutPalDB will return to using its default built-in template.

You will find a few pre-written templates stored in subfolders in the storage card. (More available online.) You can use the built in Pocket PC File Explorer to browse the template folders and copy any of the templates from its subfolder over to the database folder.  Here's how:
  1. Tap Start / Programs / File Explorer.
  2. Tap the icon just under the “Start Flag”, top left of screen. This will pull down a menu of device folder locations.
  3. Tap “My Device” if you don't see your storage card listed in the pull-down menu. Then tap the “Storage Card”, “SD Card”, or “CF Card” folder icon (depending on how your Pocket PC names its external storage card.)
  4. After navigating to the card, tap into the database folder, then tap into the folder named templates.  Inside it are nested folders where various templates are stored.  The folders are named in ways that briefly try to describe the function of the template(s) inside. For example, inside the folder named WillDingIf, you may see another folder named “+$7, -2.5m”, which implies a template that will "ding" if an item is priced $7 (or more) and also has a sales rank better (lower) than 2.5 million.
  5. Tap into the template folder of your choice; inside it will be a file named spdbtemplate.
  6. Tap Menu / Edit / Copy (or tap and hold the stylus on the spdbtemplate file name, then select Copy.)
  7. Tap “UP” (bottom left) to navigate back to the database folder.
  8. Tap Menu / Edit / Paste (or tap-and-hold in the empty space below the file list, then select Paste.) A copy of the template file will now be in the database folder.
  9. Start ScoutPalDB, then tap Settings/OK.  ScoutPalDB will read and begin using the current template file in the database folder.
  10. To stop using a template, simply use File Explorer to delete it from the database folder, then tap Settings/OK.
  11. Always tap Settings/OK after copying or deleting a template file.  (This notifies the program of the change.)

More templates at:  http://www.scoutpal.com/db/templatecenter

You can copy template files between your PDA's card and your computer in the same way that you update the database: with a card reader. You can also copy small files (like template and sound files) to your PDA's card reasonably fast using Microsoft's Active Sync in Windows XP, or Mobile Device Center in Vista and Windows 7.

Note (A): When adding a new or modified template to your PDA's card, it's a good idea to first create a new folder in the root of the card and then copy your version of the template file over to that folder. By keeping the custom template in its own separate folder, you are ensuring that it will be preserved between DB updates, and that you won't be overwriting one of the original sample templates.  Name the new folder as you wish, for example you could name the folder "my custom template", or whatever.


If you have some basic knowledge of HTML and JavaScript, you will be able to customize templates. Even if you don’t know JavaScript, you will probably be able to figure out how to make minor “tweaks” to the template logic or formatting. A Google search for “HTML reference” and/or “JavaScript tutorial” or similar will yield a wealth of tutorials and references.

To customize a template:  Find an existing template that *almost* does what you want, and put a copy of it on your computer.  Put it somewhere convenient; for example, on the Desktop or in your Documents folder.  Open it with Windows Notepad or WordPad.  Don’t use Microsoft Word or some other “word processing” type of editor, use Notepad or WordPad only.  Use of proper punctuation and syntax is critical inside the template code, but it's easy to just change a template's price/rank numbers to meet your own needs: just remember that prices and ranks inside formulas must be composed only with whole numbers, and (optionally) decimals; no commas or dollar signs.


After customizing a template and saving it, or downloading a pre-written template, copy it from your computer over to the card (preferably into its own folder that you created in Note A, above.) Then follow the numbered instructions above to try it out. No harm will be done if your newly-created template has errors, it just may not work the way you intended it to after testing, and then you will need to correct the display or logic errors.

Note (B):  There's a special function in ScoutPalDB useful for testing template changes: Tap in “X42” instead of an ISBN, then tap “Seek”, "Seek", "Seek", etc. ScoutPalDB will begin returning random database entries each time you tap Seek.  This gives an easy way to feed sample data to your new template so you can see it in action against a wide range of listings. You can easily stop this “test” mode of operation just by entering an ISBN/UPC instead of leaving it blank.