The SpecCommand has three parts (arguments), the command, the spec type, and a set of strings indicating the specs and such to be operated upon.
The first "number" is the operation ro be performed. These are define in sbasic_include.sbas:
#define SPEC_OPERATION_LOAD 0
#define SPEC_OPERATION_SAVE 1
#define SPEC_OPERATION_RUN 2
#define SPEC_OPERATION_VIEW 3
#define SPEC_OPERATION_SET 4
#define SPEC_OPERATION_CLEAR 5
#define SPEC_OPERATION_LIST 6
The second number is the spec type to be operated upon:
#define SPEC_TYPE_RETRIEVE 1
#define SPEC_TYPE_SORT 2
#define SPEC_TYPE_EXPORT 3
#define SPEC_TYPE_IMPORT 4
#define SPEC_TYPE_MASS_UPDATE 5
#define SPEC_TYPE_COPY 6
#define SPEC_TYPE_RESTRICTION 7
#define SPEC_TYPE_TABLE 8
#define SPEC_TYPE_PRINT_SETTINGS 9
#define SPEC_TYPE_QREPORT 10
If you right click in the programming editor, one of the menu choices is "List Browser". The list browser lists all of the SBasic commands/functions in a searchable list with descriptions (and often examples) for each.
Here is the list browser entry for SpecCommand:
@SpecCommand provides a single function that can perform a set of spec commands on any of the Sesame runtime spec types.
@SpecCommand takes three required arguments, operation as an integer, spec_type as an integer, and command_string as string It also accepts a variable number of optional arguments: ... as a string.
operation can be:
SPEC_OPERATION_LOAD
SPEC_OPERATION_SAVE
SPEC_OPERATION_RUN
SPEC_OPERATION_VIEW
SPEC_OPERATION_SET
SPEC_OPERATION_CLEAR
SPEC_OPERATION_LIST
spec type can be:
SPEC_TYPE_RETRIEVE
SPEC_TYPE_SORT
SPEC_TYPE_EXPORT
SPEC_TYPE_IMPORT
SPEC_TYPE_MASS_UPDATE
SPEC_TYPE_COPY
SPEC_TYPE_RESTRICTION
SPEC_TYPE_TABLE
SPEC_TYPE_QREPORT
The command_string argument can can repeated to send multiple strings. This function returns the spec as a string array when used with the VIEW operation.
Examples:
// Loads an already saved retrieve spec for use
vStr = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_RETRIEVE, "MyRetrieveSpec")
// Saves the currrent retrieve spec as "MyName"
vStr = @SpecCommand(SPEC_OPERATION_SAVE, SPEC_TYPE_RETRIEVE, "MyName")
// Runs the currently loaded retrieve spec
vStr = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_RETRIEVE, "")
// Returns the current retrieve spec to the variable "vStr"
vStr = @SpecCommand(SPEC_OPERATION_VIEW, SPEC_TYPE_RETRIEVE, "")
// Set the current retrieve spec so that last name begins with "w" and first name begins with "w"
vStr = @SpecCommand(SPEC_OPERATION_SET, SPEC_TYPE_RETRIEVE, "Last Name=m..", "First Name=w..")
// Clears the current retrieve spec
vStr = @SpecCommand(SPEC_OPERATION_CLEAR, SPEC_TYPE_RETRIEVE, "")
// Returns a list of saved retrieve specs
vStr = @SpecCommand(SPEC_OPERATION_LIST, SPEC_TYPE_RETRIEVE, "")