Running from Other Applications


You can run Stonefield Query from the Windows Command Prompt, the Windows Run dialog, a batch file, or another application so you don't have to find its icon on the Windows Desktop or in the Start menu and so you can have it automatically log in or run a particular report. To do so, execute:

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 for AccountMate\SFQuery.exe"

There are two ways you can call Stonefield Query: passing parameters on the command line or putting the parameters into a text file and passing the name of that file to Stonefield Query.

Command Line Parameters

Stonefield Query accepts the following parameters that tell it how to behave. Note that for all parameters, if there are any spaces in any part of the parameter, surround the entire parameter with quotes.

Parameters File

If the command line becomes too long (more than 255 characters) 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" to the command line, where filename is the name of the file containing the parameters. For example:

"C:\Program Files\Stonefield Query for AccountMate\SFQuery.exe" "parameters=C:\My Documents\Parameters.xml"

Specify the parameters in the file using the following XML structure:

<parameters>
  <settings attributes/>
  <report attributes>
    <values>
      <value value="value for condition"/>
    </values>
    additional values nodes
  </report>
  <report attributes>
    <values>
      <value value="value for condition"/>
    </values>
    additional values nodes
  </report>
  additional report nodes
</parameters>

There is only one settings element per file. As is usual with XML, specify attributes using:

attributename="value"

Note that quotes are required whether there are spaces in the values or not. Also, XML is case-sensitive, so be sure to specify element and attribute names in lower-case.

The attributes for settings are:

You can also specify custom attributes. Stonefield Query doesn't use these attributes but code you use anywhere in Stonefield Query could. Here's an example:

<settings ini="C:\Program Files\Stonefield Query for AccountMate\Data" MyCustom1="A" MyCustom2="B"/>

Each report element represents one report. You can have as many report nodes as you wish; each will run a report. If there are no value sub-elements of a report element, you can specify an "empty" element by closing the report tag with "/>"; otherwise, you will need a closing </report> tag.

The attributes for the report node are:

The values and value elements are used to pass the values for ask-at-runtime conditions to the report. For dates, use the format YYYY-MM-DD. For logical or Boolean fields, use "T", "True", "Y", or "Yes" for True (anything else is considered to be False). For the "is between" or "is one of" operators, specify each value in its own value element. Omit the value (that is, use an empty value element) to ignore the condition.

Example:

<report name="Customer Activity Report">
  <values>
    <value value="2008-01-01"/>
    <value value="2008-12-31"/>
  </values>
</report>