Running from Other Applications |
directory\SFQuery.exe
In place of directory, enter the directory where Stonefield Query is installed. If there is a space in the directory, put quotes around this command. For example:
"C:\Program Files\Stonefield Query\SFQuery.exe"
If the Stonefield Query configuration files aren't located in the same directory as SFQUERY.EXE and Stonefield Query hasn't been run before on this computer, add "ini=directory" to the command line. In place of directory, enter the directory where the configuration files are located. Again, if there are any spaces in the directory, surround the entire parameter with quotes.
To automatically log into Stonefield Query, add "user=username" and "password=userpassword" to the command line. In place of username and userpassword, enter the user name and password. Here's an example (although this example is displayed on several lines for formatting purposes, enter everything on one line):
"C:\Program Files\Stonefield Query\SFQuery.exe" user=etaylor password=diamond
If more than one database is available, specify a particular database to use by adding "database=databasename" to the command line. In place of databasename, enter the name of the database as you see it in the Stonefield Query Open Database dialog. If there are any spaces in the database name, surround the entire parameter with quotes. Here's an example:
"C:\Program Files\Stonefield Query\SFQuery.exe" user=etaylor password=diamond "database=My Database"
If you want Stonefield Query to automatically print a particular report, add "report=reportname" to the command line. In place of reportname, enter the name of the report. Put quotes around the entire parameter (for example, "report=My Activity Report") if there are any spaces in the report name. If you want to run more than one report, specify "report1=reportname1", "report2=reportname2", and so forth.
Stonefield Query can also accept several other parameters that tell it how to behave:
| Decimal Value | Hex Value | Meaning |
|---|---|---|
| 0 | 0x0 | Report ran successfully. |
| -1 | 0xFFFFFFFF | Stonefield Query terminated with an unexpected error. |
| -2 | 0xFFFFFFFE | There is no default printer driver. |
| -10 | 0xFFFFFFF6 | The request is to output to file but no file name was specified. |
| -11 | 0xFFFFFFF5 | The report name specified does not exist. |
| -12 | 0xFFFFFFF4 | An error occurred running the report. |
| -13 | 0xFFFFFFF3 | The report has ask-at-runtime conditions and not all values were provided. |
| -14 | 0xFFFFFFF2 | Login failed: the user name and password weren't specified or were incorrect or that user is already logged in. |
| -15 | 0xFFFFFFF1 | The demo or unactivated version has expired. |
| -16 | 0xFFFFFFF0 | The location of the configuration files could not be determined. |
| -17 | 0xFFFFFFEF | A component is missing. Please reinstall Stonefield Query. |
| -18 | 0xFFFFFFEE | The reports table cannot be opened. |
| -19 | 0xFFFFFFED | The security tables cannot be opened. |
| -20 | 0xFFFFFFEC | A script failed. |
| -21 | 0xFFFFFFEB | There are no data sources available to query on. |
| -22 | 0xFFFFFFEA | The location of the reports table has not been specified. |
| -23 | 0xFFFFFFE9 | Invalid license file. |
| -24 | 0xFFFFFFE8 | Setting up of the data and report engines failed. |
| -25 | 0xFFFFFFE7 | The printer name specified in the PRINTER= parameter does not exist. |
| -26 | 0xFFFFFFE6 | An invalid output type was specified. |
| -27 | 0xFFFFFFE5 | The resource file (SQResource.DBF) cannot be located. |
If the command line becomes too long (Stonefield Query only accepts 15 parameters; more than that cause an error) or you'd rather put the parameters into a file for more flexibility (it's probably easier to change the contents of a file than to change how Stonefield Query is called), specify the name of the file containing the parameters by adding "parameters=filename", where filename is the name of the file containing the parameters. The file must contain the same format of parameters passed on the command line, with each parameter on a separate line, except you don't need quotes even if there are spaces in the names. Here's an example of such a file that outputs the Activity Report for March 2001 to an Excel document named C:\Temp\My Spreadsheet.xls and the History Report to a PDF file named C:\Temp\MyPDF.pdf, and then exits Stonefield Query:
report1=Activity Report filename1=C:\Temp\My Spreadsheet.xls value1=2001-03-01,2001-03-31 report2=History Report filename2=C:\Temp\MyPDF.pdf user=etaylor password=diamond
Here are some examples of these parameters (although these examples are displayed on several lines for formatting purposes, enter everything on one line):
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" user=etaylor password=diamond
Prints the Activity Report to the printer.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" preview user=etaylor password=diamond
Displays the Activity Report in the preview window.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" preview value=2001-03-01,2001-03-31 user=etaylor password=diamond
Displays the Activity Report in the preview window for records between March 31, 2001 and March 31, 2001 (assuming an ask at runtime condition on the date range).
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" filename=C:\Temp\MySpreadsheet.xls user=etaylor password=diamond
Outputs the Activity Report to an Excel document named C:\Temp\MySpreadsheet.xls and brings up Excel once the document is ready.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" filename=C:\Temp\MySpreadsheet.xls noshow user=etaylor password=diamond
Outputs the Activity Report to an Excel document named C:\Temp\MySpreadsheet.xls but doesn't bring up Excel.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" preview exit user=etaylor password=diamond
Displays the Activity Report in the preview window and exits Stonefield Query once the preview window is closed.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" "filename=C:\Temp\My Spreadsheet.xls" exit user=etaylor password=diamond
Outputs the Activity Report to an Excel document named C:\Temp\My Spreadsheet.xls, exits Stonefield Query, and opens the document in Excel.
"C:\Program Files\Stonefield Query\SFQuery.exe" "report=Activity Report" mailto=myboss@mycompany.com "subject=This Week's Activity Report" "body=Here's the activity report for this week." exit user=etaylor password=diamond
Emails the Activity Report as a PDF file attached to a message sent to myboss@mycompany.com.