Go  to ShowTheBest.Com

ShowTheBest.Com

Interactive tables on your web pages

Getting the Case Database and Display Database (DDB) from an External Program

ShowTheBest.Com provides a simple interface to external programs that can dynamically build the Case Database Table or the Display Database. You need to supply a program that passes one (or two) text strings as parameters: these text strings denote file names (that will be supplied by the ShowTheBest.Com calling program). Your program needs to follow the Case Database and DDB conventions: the program needs to create one (or two) a tab-delimited text file(s) with the first row specifying the number of rows and columns for the Case Database (and number of rows only for the DDB).

The sequence of operation for external access of a Case Database (and possibly Display Database) is:

  1. The ShowTheBest.Com calling program creates one or two file names
    One file name is for the Dase Database; another file names is created for the Display Database if the "Use Display Database" parameter was checked in the Control Tool (see the example below).
  2. ShowTheBest.Com calls the external program (not a CGI program) that you specified with the Control Tool, and passes these names to your program.
  3. Your program opens the files with these filenames
    Your program writes the data to the files, and then closes the files. That's all your program needs to do.
  4. ShowTheBest.Com processes this files
    The ShowTheBest.Com calling program deletes the files when it is finished with them. You do not have to worry about file names or file management.

In addition to the filenames, ShowTheBest.Com passes your program an optional text parameter that your program can decode. Your program can use this parameter to customize your query so it can depend on user selections.

Here is an example of the ShowTheBest.Com database interface. The following display shows the results of a Database Table that is dynamically generated by a Perl program that accesses an SQL database.  First we need to specify the calling script with the Controls Tool. We first specify the Interactive Table Directory...

...and in the last form input, we specify the executable script (without arguments). In this case, we call the Perl interpreter with the Perl program mealzdemo.pl.(The arguments to the Perl program are discussed below. We also assume that at this point, the Perl program was already debugged.)

Now when we go to the ShowTheBest.Com Design Tool for map specification, we can specify the Interactive Table Directory together with another optional argument to the Perl program mealzdemo.pl.

When the execution of the external program is successful, ShowTheBest.Com lets us know that the Case Database Table was grabbed from a DBMS server....

Build the external program call so that it has 2 or 3 input arguments. The generic form of the external program invocation looks like this:

>shellName programName tableFileString [ddbFileString ] StringofOtherParameters

Here is an example with mealzdemo.pl.....

To test the external program call, just invoke it with some parameters:

>perl mealzdemo.pl demo.txt 1

Note that mealzdemo has two arguments: one for the Database Table (the file name demo.txt) and another for specifying the query (the string "1"). The results of the query are sent to the file demo.txt....

In server operation, ShowTheBest.Com generates file names and creates and deletes temporary files so that there are no conflicts, inconsistencies, or wasted disk storage.

(View the HTML source if there are any problems in loading the ShowTheBest.Com Interactive Table specifications. If ShowTheBest has any problems it will let you know via HTML comments.)


 

 

© 2002 Inductive Solutions, Inc. All Rights Reserved.