next up previous contents index
Next: C.3 Global functions Up: C. Python API Previous: C.1 Constants   Contents   Index

Subsections

C.2 Utility classes

The following is a utility class for holding and returning parameters used with Worksheet.performGoalSeek(). Its fields are public.

C.2.1 class GoalSeekContext

new(varRow,varCol,targetRow,targetCol,
                  goal,tolerance,bracketLow,bracketHigh,iterations);

GoalSeekContext contains the parameters for a goal seek. The Worksheet.performGoalSeek() method modifies bracketHigh, bracketLow, and iterations after using them and sets status.

Parameters:
varRow - the row of the cell to be varied
varCol - the column of the cell to be varied
targetRow - the row of the target cell that is intended to reach the goal
targetCol - the column of the target cell that is intended to reach the goal
goal - the goal value to which the target cell should be driven
tolerance - the absolute value of the minimum allowed difference between the goal and the resulting value in the target cell
bracketLow - the low end of the range containing the goal value; after performing a goal seek, it contains the low end of the bracket determined by the goal seek
bracketHigh - the high end of the range containing the goal value; after performing a goal seek, it contains the high end of the bracket determined by the goal seek
iterations - the number of iterations for which the goal seek should run; after a goal seek, it contains the number of iterations used in seeking the goal
Returns:
a new GoalSeekContext

DESTROY

Destroys a GoalSeekContext.

Parameters:
none
Returns:
none

$this$\rightarrow${varRow}

the row of the cell to be varied

$this$\rightarrow${varCol}

the column of the cell to be varied

$this$\rightarrow${targetRow}

the row of the target cell that is intended to reach the goal

$this$\rightarrow${targetCol}

the column of the target cell that is intended to reach the goal

$this$\rightarrow${goal}

the goal value to which the target cell should be driven

$this$\rightarrow${tolerance}

the absolute value of the minimum allowed difference between the goal and the resulting value in the target cell

$this$\rightarrow${bracketLow}

the low end of the range containing the goal value; after performing a goal seek, it contains the low end of the bracket determined by the goal seek

$this$\rightarrow${bracketHigh}

the high end of the range containing the goal value; after performing a goal seek, it contains the high end of the bracket determined by the goal seek

$this$\rightarrow${iterations}

the number of iterations for which the goal seek should run; after a goal seek, it contains the number of iterations used in seeking the goal

$this$\rightarrow${status}

the status returned by Worksheet.performGoalSeek(); it is one of the GoalSeekStatus values

C.2.2 class SortContext

new(keyCol,direction,update);

A SortContext specifies how a sort is performed. The columns specified as keys are used as primary, secondary, etc. keys to sort the data. Up to five keys may be used and are used in the order specified in the list (i.e., first key in the list is the primary key). The sort uses keys beyond the primary key in cases where the primary does not differentiate the entries. For each key, an order of ascending or descending is specified. If the update field in the context is true, the sort updates cell references according to where the referenced cells have moved.

See Range.sortRows().

Parameters:
keyCol - the primary key column in the sort
direction - the direction to sort; one of the SortDirectionType constants
update - SpreadScript keeps track of what it moves and where and can update cell references throughout the spreadsheet to reflect the changes that occurred while sorting. If update is one (true), it performs this updating, and if update is zero (false), it does not.
Returns:
a new SortContext instance

DESTROY

Destroys a SortContext.

Parameters:
none
Returns:
none

append(keyCol,direction);

Appends a key column and its sort direction to the list.

Parameters:
keyCol - column to be used as a key in sorting
direction - one of SortDirectionType constants
Returns:
none

prepend(keyCol,direction);

Prepends a key column and its sort direction to the list.

Parameters:
keyCol - column to be used as a key in sorting
direction - one of SortDirectionType constants
Returns:
none

getNumKeys();

Gets the number of keys specified in the current list.

Parameters:
none
Returns:
current number of keys in the list

getKey(index);

Gets the specified key and direction.

Parameters:
index - the index of the sorting key to retrieve
Returns:
a list/array containing the key column and direction for the specified sorting key; column is set to -1 if a key that does not exist is requested

deleteKey(index);

Deletes the specified sorting key.

Parameters:
index - the key to remove from the list
Returns:
none

$this$\rightarrow${update}

public field that controls how cell references are updated


next up previous contents index
Next: C.3 Global functions Up: C. Python API Previous: C.1 Constants   Contents   Index
SpreadScript User's Guide, Version 1.2
Grey Trout Software
02 March 2003