Interface IField
Represents an Index Field of an object (INode) in a Batch.
Note: Write-access to properties depends on the context in which the model is used. When in a read-only context, set* methods will throw an Error.
Properties
list
Methods
list
Properties
dataType
Declaration
readonly dataType: string;
Property Value
dateTimePattern
Declaration
readonly dateTimePattern: string;
Property Value
defaultValue
Declaration
readonly defaultValue: string;
Property Value
displayLabel
Declaration
readonly displayLabel: string;
Property Value
displayTip
Declaration
readonly displayTip: string;
Property Value
hidden
Declaration
readonly hidden: boolean;
Property Value
length
Declaration
Property Value
multiValue
Declaration
readonly multiValue: boolean;
Property Value
name
Declaration
Property Value
parsedValue
Declaration
Property Value
readOnly
Declaration
readonly readOnly: boolean;
Property Value
required
Declaration
readonly required: boolean;
Property Value
review
Declaration
Property Value
reviewDetails
Declaration
Property Value
scale
Declaration
Property Value
sqlType
Declaration
readonly sqlType: number;
Property Value
sticky
Declaration
readonly sticky: boolean;
Property Value
table
Declaration
Property Value
value
Declaration
Property Value
valueAsListItem
Declaration
readonly valueAsListItem: IListItem;
Property Value
valueCount
Declaration
readonly valueCount: number;
Property Value
Methods
If this field is of type TIMESTAMP or DATETIME, it will return true if there is a time pattern.
Declaration
dateFormatIncludesTime(): boolean;
Returns
getCommitValue(useDescriptionIfValueIsEmpty)
This is a utility method for those cases where this is a list field (e.g. isList() returns true). It provides a uniform way to get the 'commit' value of a field.
List fields have an associated/backing array of value/description items (ListItems) and the 'commit' value is the 'value' attribute of the ListItem.
Declaration
getCommitValue(useDescriptionIfValueIsEmpty: boolean): string;
Parameters
| Type |
Name |
Description |
| boolean |
useDescriptionIfValueIsEmpty |
since list fields may have one attribute instead of two (e.g. only have 'description' instead of 'value/description'), setting this to true will use the 'description' as the commit value (since the 'value' attribute does not exist). If this is set to false and no 'value' attribute exists, the returned value will be an empty String. If you want to make sure that this method always returns a value, set this parameter to true.
|
Returns
| Type |
Description |
| string |
the 'commit' value of this field
|
getCommitValueAsObject(useDescriptionIfValueIsEmpty)
This method uses the same logic as the IField.getCommitValue() method but tries to parse the String representation and return an Object.
Declaration
getCommitValueAsObject(useDescriptionIfValueIsEmpty: boolean): any;
Parameters
Returns
| Type |
Description |
| any |
this method may return null if there is no 'value' attribute and the useDescriptionIfValueIsEmpty parameter is set to false.
|
getCommitValueAsObjectAt(index, useDescriptionIfValueIsEmpty)
This method uses the same logic as the method but tries to parse the String representation and return an Object.
Declaration
getCommitValueAsObjectAt(index: number, useDescriptionIfValueIsEmpty: boolean): any;
Parameters
| Type |
Name |
Description |
| number |
index |
|
| boolean |
useDescriptionIfValueIsEmpty |
|
Returns
getCommitValueAt(index, useDescriptionIfValueIsEmpty)
For the case of multi-value Index Field, this method returns the commit value of the given row.
see IField.getCommitValue()
Declaration
getCommitValueAt(index: number, useDescriptionIfValueIsEmpty: boolean): string;
Parameters
| Type |
Name |
Description |
| number |
index |
|
| boolean |
useDescriptionIfValueIsEmpty |
|
Returns
getDataType()
Returns the data type of this Index Field. The following are the possible values:
- String
- Date
- Time
- Float
- Double
- Integer
- Short
- Numeric
Declaration
Returns
getDateTimePattern()
If this field is of type DATE or TIME or DATETIME, or TIMESTAMP, this method will return the date/time pattern.
Declaration
getDateTimePattern(): string;
Returns
getDefaultValue()
Returns the default value for this Index Field, if specified.
Declaration
getDefaultValue(): string;
Returns
getDisplayLabel()
Returns the display label for this Index Field, if specified.
Declaration
getDisplayLabel(): string;
Returns
getDisplayTip()
Returns the display tip for this Index Field, if specified.
Declaration
Returns
getFieldValidations()
Declaration
getFieldValidations(): IFieldValidation[];
Returns
getLength()
Returns an Index Field's maximum allowable length. This field only makes sense for String and Numeric types. For Strings, it gives the maximum length of the allowed String, for Numeric it gives the maximum number of digits, including integral and fractional parts.
Declaration
Returns
getName()
Returns the name of this Index Field.
Declaration
Returns
getOptions()
Returns the list of predefined values specified for this Index Field.
Declaration
getOptions(): IListItem[];
Returns
getOptionsAt(index)
For the case of multi-value Index Field, returns the list of predefined values specified for the given row. 0-based index of the row the list of predefined values specified for the given row.
Declaration
getOptionsAt(index: number): IListItem[];
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getParsedValue()
Returns the value of this Index Field after it has been parsed internally and 'stringified' again. The returned value is in the current 'user' format: that is, in case of number, the format of the current user locale, in case of dates in the format specificed by the field type date-time pattern.
If the value cannot be parsed (e.g. it is invalid), it is returned as is (no Error is thrown).
Declaration
getParsedValue(): string;
Returns
getParsedValueAt(index)
For the case of multi-value Index Fields, this function returns the value of the given row after it has been parsed internally and 'stringified' again. The returned value is in the current 'user' format: that is, in case of number, the format of the current user locale, in case of dates in the format specified by the field type date-time pattern.
If the value cannot be parsed (e.g. it is invalid), it is returned as is (no exception is thrown).
Declaration
getParsedValueAt(index: number): string;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getReview()
Declaration
Returns
| Type |
Description |
| boolean |
whether the review attribute is set
|
getReviewAt(index)
For the case of multi-value Index Field, this function returns the review flag for the given row of this Index Field.
Declaration
getReviewAt(index: number): boolean;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getReviewDetails()
Returns the review details (warn message)
The reviewDetails is a transient property: this means that it is not automatically persisted to the server. It keeps the value for as long as a IBatch is open in the client.
Declaration
getReviewDetails(): string;
Returns
getReviewDetailsAt(index)
Returns the review details (warn message) at the given row of a multi-value Index Field The reviewDetails is a transient property: this means that it is not automatically persisted to the server. It keeps the value for as long as a is open in the client.
Declaration
getReviewDetailsAt(index: number): string;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getScale()
Returns a Numeric Index Field's maximum length of the fractional part.
Declaration
Returns
getSqlType()
Returns the SQL Type (a constant from java.sql.Types). For a TIMESTAMP or a DATETIME field, this method will return java.sql.Types.DATE if there is no time pattern, else it will return a java.sql.Types.TIMESTAMP.
For other types it will return the appropriate java.sql.Type.
Declaration
Returns
getTable()
For the case of multi-value Index Field, returns the ITable object to which the Index Field belongs. the parent ITable, if this Index Field is multi-value, or null otherwise.
Declaration
Returns
getType()
Returs the name of the type of this field.
Declaration
Returns
getValue()
Returns the value of this Index Field in String form.
Declaration
Returns
getValueAsListItem()
If this is a list field (e.g. isList() returns true), then this method will return the ListItem associated with the current value. Be careful since this method may return null if the current value is not really from the selected list (can happen if the field type list is not strict).
Declaration
getValueAsListItem(): IListItem;
Returns
getValueAsListItemAt(index)
For the case of a multi-value field which is a list (e.g. isList() returns true), this method returns the ListItem associated with its value at the given row. Be careful since this method may return null if the current value is not really from the selected list (can happen if the field type list is not strict).
Declaration
getValueAsListItemAt(index: number): IListItem;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getValueAsObject()
Returns the value of this Index Field. If the value is invalid, this method will throw an Error.
Declaration
Returns
getValueAsObjectAt(index)
For the case of multi-value Index Field, this function returns the value of the given row. If the value is invalid, this method will throw an exception.
Declaration
getValueAsObjectAt(index: number): any;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getValueAt(index)
For the case of multi-value Index Field, this function returns the value of the given row in String form.
Declaration
getValueAt(index: number): string;
Parameters
| Type |
Name |
Description |
| number |
index |
|
Returns
getValueCount()
For the case of multi-value Index Field, returns the number of rows of the table to which the Index Field belongs. If the Index Field is not multi-value, it returns 1. the number of rows in the table, if this Index Field is multi-value, or 1 otherwise.
Declaration
Returns
isHidden()
Returns whether this Index Field is hidden
Declaration
Returns
isList()
Returns whether this Index Field uses a pre-populated list of values
Declaration
Returns
isMultiValue()
Returns whether this Index Field is multi-value. In other, words it returns whether this Index Field belongs to a Table that can have multiple rows. if the Index Field is multi-value, otherwise
Declaration
Returns
isReadOnly()
Returns whether this Index Field is read-only
Declaration
Returns
isRequired()
Returns whether this Index Field is required
Declaration
Returns
isSticky()
Returns whether this Index Field is sticky. Sticky Index Fields have the same value for all documents in a batch.
Declaration
Returns
isValid(value)
Checks whether the given value is valid. The given value is checked against the IFieldValidation validators assigned on this Field.
Declaration
isValid(value: string): boolean;
Parameters
| Type |
Name |
Description |
| string |
value |
the value to check, given in user format
|
Returns
setParsedValue(value)
Sets the value of this Index Field in a read-write context. By default, this method will write the value to the property with name idx.<field_name>.value. The value expected here is a stringified version, according to the field type, given in 'user' format. For example, if this is a date field with a format "M/d/y", then the value expected here should be a String in this format (e.g. 2/3/2015 for Feb 3, 2015). Before this value is saved, it will be converted in the standard format (e.g. 2015-02-03).
If parsing of the value fails, it will be stored as is.
Note: this method will throw an Error if invoked in a read-only context.
Declaration
setParsedValue(value: string): void;
Parameters
| Type |
Name |
Description |
| string |
value |
the new value of this Index Field
|
Returns
setReview(value)
Sets the review attribute for this field
Declaration
setReview(value: boolean): void;
Parameters
| Type |
Name |
Description |
| boolean |
value |
the new value
|
Returns
setReviewAt(index, value)
For the case of multi-value Index Field, this function sets the review flag for the given row of this Index Field.
Declaration
setReviewAt(index: number, value: boolean): any;
Parameters
| Type |
Name |
Description |
| number |
index |
|
| boolean |
value |
|
Returns
setReviewDetails(reviewDetails)
Sets the reviewDetails property. Remember that this is a transient property only.
Declaration
setReviewDetails(reviewDetails: string): void;
Parameters
| Type |
Name |
Description |
| string |
reviewDetails |
the details of the review
|
Returns
setReviewDetailsAt(index, reviewDetails)
Sets the reviewDetails property for the given row of a multi-value field. Remember that this is a transient property only.
Declaration
setReviewDetailsAt(index: number, reviewDetails: string): any;
Parameters
| Type |
Name |
Description |
| number |
index |
|
| string |
reviewDetails |
|
Returns
setValue(value)
Sets the value of this Index Field in a read-write context. By default, this method will write the value to the property with name idx.<field_name>.value. You should make sure that the value you write is in the standard internal format. For example, if you are setting a date like Feb 3, 2015, the value should be '2015-02-03'. Do not call this method with a user-formatted value (e.g. 3/2/2015) because it will create incosistencies that are hard to identify later.
Note: this method will throw an Error if invoked in read-only context.
Declaration
setValue(value: string): void;
Parameters
| Type |
Name |
Description |
| string |
value |
the new value of this Index Field in standard format
|
Returns
setValueAt(index, value)
For the case of multi-value Index Field, this function sets the value of the given row of this Index Field.
Declaration
setValueAt(index: number, value: string): any;
Parameters
| Type |
Name |
Description |
| number |
index |
|
| string |
value |
|
Returns