TableValidation.Context
Description
A class that represents a TableValidation Context. The context stores data that persists through the duration of a rule.
Properties
col | Gets the column the value is in. |
endCol | Gets the last column of the range. |
endRow | Gets the last row of the range. |
errorMessage | Gets/sets the errorMessage. |
isFirstCol | returns a 1 if the column the value is in is the first column of the range. |
isFirstRow | returns a 1 if the row the value is in is the first row of the range. |
isFirstValue | returns a 1 if the value is the first value in the range. |
isLastCol | returns a 1 if the column the value is in is the last column of the range. |
isLastRow | returns a 1 if the row the value is in is the last row of the range. |
isLastValue | returns a 1 if the value is the last value in the range. |
labels | Accesses the context's labels as nodes. |
row | Gets the row the value is in. |
startCol | Gets the starting column of the range. |
startRow | Gets the starting row of the range. |
table | Gets table that is currently being validated. |
Methods
addRegex | Stores a regular expression by name in the context. |
valueMatchesRegex | Compares the value against a stored regular expression in the context. |
Details
TableValidation.Context.col
readonly int col
Description
Gets the column the value is in.
TableValidation.Context ctx = param(2);
int column = ctx.col;
TableValidation.Context.endCol
readonly int endCol
Description
Gets the last column of the range.
TableValidation.Context ctx = param(2);
int endColumn = ctx.endCol;
TableValidation.Context.endRow
readonly int endRow
Description
Gets the last row of the range.
TableValidation.Context ctx = param(2);
int endRow = ctx.endRow;
TableValidation.Context.errorMessage
string errorMessage
Description
Gets/sets the errorMessage.
The errorMessage is by default the Failure Message defined on the rule. It is what is displayed at the end of a logged error message.
TableValidation.Context ctx = param(2);
ctx.errorMessage = "The value was not an integer";
TableValidation.Context.isFirstCol
readonly int isFirstCol
Description
returns a 1 if the column the value is in is the first column of the range.
TableValidation.Context ctx = param(2);
int isFirstCol = ctx.isFirstCol;
TableValidation.Context.isFirstRow
readonly int isFirstRow
Description
returns a 1 if the row the value is in is the first row of the range.
TableValidation.Context ctx = param(2);
int isFirstRow = ctx.isFirstRow;
TableValidation.Context.isFirstValue
readonly int isFirstValue
Description
returns a 1 if the value is the first value in the range.
TableValidation.Context ctx = param(2);
int isFirstValue = ctx.isFirstValue;
TableValidation.Context.isLastCol
readonly int isLastCol
Description
returns a 1 if the column the value is in is the last column of the range.
TableValidation.Context ctx = param(2);
int isLastCol = ctx.isLastCol;
TableValidation.Context.isLastRow
readonly int isLastRow
Description
returns a 1 if the row the value is in is the last row of the range.
TableValidation.Context ctx = param(2);
int isLastRow = ctx.isLastRow;
TableValidation.Context.isLastValue
readonly int isLastValue
Description
returns a 1 if the value is the last value in the range.
TableValidation.Context ctx = param(2);
int isLastValue = ctx.isLastValue;
TableValidation.Context.labels
readonly labels
Description
Accesses the context's labels as nodes.
Works just like labels on treenodes.
TableValidation.Context.row
readonly int row
Description
Gets the row the value is in.
TableValidation.Context ctx = param(2);
int column = ctx.col;
TableValidation.Context.startCol
readonly int startCol
Description
Gets the starting column of the range.
TableValidation.Context ctx = param(2);
int column = ctx.col;
TableValidation.Context.startRow
readonly int startRow
Description
Gets the starting row of the range.
TableValidation.Context ctx = param(2);
int column = ctx.col;
TableValidation.Context.table
readonly Table table
Description
Gets table that is currently being validated.
TableValidation.Context ctx = param(2);
Table table = ctx.table;
TableValidation.Context.addRegex()
void addRegex( RegExp pattern , string name ) |
Parameters
pattern | The pattern of characters to look for, a regular expression. |
name | The name of the pattern. |
Description
Stores a regular expression by name in the context.
TableValidation.Context ctx = param(2);
ctx.addRegex(/^[a-zA-Z]$/, "matchRegex");
TableValidation.Context.valueMatchesRegex()
int valueMatchesRegex( Variant value , string regexName ) |
Parameters
value | The value you are matching the regular expression to. |
regexName | the name of the regex stored on the context using addRegex. |
Returns
int | If it matched. |
Description
Compares the value against a stored regular expression in the context.
Variant value = param(1);
TableValidation.Context ctx = param(2);
ctx.valueMatchesRegex(value, "matchRegex");