LCField Class Methods and Properties Summary

The methods for the LCField class are summarized as follows.

Allocation

The following methods create and free Field instances.

Method

Description

New LCField

(Constructor) Allocates a new Field object instance.

LCField.Copy

Creates a new Field object instance as a copy of another field. The field data is also copied.

Delete LCField

(Destructor) Frees a Field object instance allocated with the constructor or LCField.Copy. This method does not free fields created as part of a fieldlist.

Field Properties

The following methods support retrieval of field properties and assignment of mutable field properties.

Method

Description

LCField.GetVirtualCode

Checks if a field has this virtual code set.

LCField.ListVirtualCode

Lists the virtual code(s) for a field.

LCField.SetVirtualCode

Sets a virtual code for a field.

Field Format

The following methods support retrieval of field format information. Setting the format for a field clears all current data values for that field.

Method

Description

LCField.GetFormatNumber

Retrieves the current format settings for a number field.

LCField.SetFormatNumber

Assigns the current format settings for a number field.

LCField.GetFormatDatetime

Retrieves the current format settings for a datetime field.

LCField.SetFormatDatetime

Assigns the current format settings for a datetime field.

LCField.GetFormatStream

Retrieves the current format settings for a stream field.

LCField.SetFormatStream

Assigns the current format settings for a stream field.

Field Data

The following methods support access to and modification of field data and NULL indicators.

Method

Description

LCField.IsNull

Queries whether a specific field data value is NULL.

LCField.SetNull

Assigns the NULL indicator for a specific field data value.

LCField.Get<Type>

Retrieves a specific field data value as a particular data type, converting the data if necessary.

LCField.Set<Type>

Assigns a specific field data value from a particular data type, converting the data if necessary.

Miscellaneous

The following methods provide compare and conversion functionality.

Method

Description

LCField.Compare

Compare data values between two fields.

LCField.Convert

Convert data values between two fields.

LCField Properties

The following are the properties for the LCField class:

Property

Description

Count

Long. One or greater. Data space for this many data values and NULL indicators will be allocated. The value count is automatically assigned for fields in a fieldlist based on the fieldlist record count (see Fieldlist description). Assigned at creation and Read-Only.

Datatype

Long. One of the Connector data type. Assigned at creation and Read-Only.

Flags

Long. Zero or more of the following field flags ORed together.

LCFIELDF_NO_NULL -- Field cannot be NULL.

LCFIELDF_TRUNC_PREC -- Allow precision truncation.

LCFIELDF_TRUNC_DATA -- Allow data truncation.

LCFIELDF_NO_FETCH -- Do not FETCH this field.

LCFIELDF_NO_INSERT -- Do not INSERT this field.

LCFIELDF_NO_UPDATE -- Do not UPDATE this field.

LCFIELDF_NO_REMOVE -- Do not REMOVE this field.

LCFIELDF_NO_CREATE -- Do not CREATE this field.

LCFIELDF_NO_DROP -- Do not DROP this field.

LCFIELDF_KEY -- Field is a KEY for keyed operations.

LCFIELDF_KEY_GT --Key condition is greater than or equal. For "greater than," use LCFIELDF_KEY_GT+ LCFIELDF_KEY_NE.

LCFIELDF_KEY_LT --Key condition is less than or equal. For "less than," use LCFIELDF_KEY_LT+ LCFIELDF_KEY_NE.

LCFIELDF_KEY_NE -- Key condition is not equal to.

LCFIELDF_KEY_LIKE

Key condition is like (native pattern match).

IsNull

Boolean. True or False.

Text

Array of string representations.

Note: Though an LCField's values are indexed from 1 to Count for purposes of the method calls, the Text property returns an array indexed from 0 to Count-1, consistent with the LotusScript® default for array representations. The value returned is an array even if the field is not multi-valued. This is a read/write property, so you can assign the field by assigning the property, much the same as you can a Notes® document field. However, you must assign the entire property, that is, fld.Text = var, not field.Text(0) = var.

Value

Array of LotusScript® data types. The value or values contained depend on the data type of the field, as listed. As for the Text method, the array begins with index 0. The value returned is an array even if the field is not multi-valued. Like Text, the Value property can be assigned to set the value of all field elements. To assign one at a time, see the Set<type> methods in this chapter.

Field Type

Value Return Type

LCTYPE_CURRENCY

Currency

LCTYPE_DATETIME

Variant (Date/Time)

LCTYPE_INT

Long

LCTYPE_FLOAT

Double

LCTYPE_NUMERIC

Double

LCTYPE_TEXT

String

LCTYPE_BINARY

String

Field Format

The format of a field is specific to its general class of type: number (int, float, currency, numeric), datetime, or stream (text and binary). For all format values, zero indicates that the specified information is not used for this field. The information for each data type is given as follows.

Note: Number and Datetime formats do not affect the actual data, but are used for data creation only. Stream format does affect the actual data.

Number (INT, FLOAT, CURRENCY, NUMERIC)

Flags: zero or more of the following constants. Multiple constants can be ORed together:

Constant

Description

LCNUMBERF_UNSIGNED

Source type is unsigned.

LCNUMBERF_NUMERIC

Source type is NUMERIC (unnecessary with LCTYPE_NUMERIC).

LCNUMBERF_DECIMAL

Source type is DECIMAL.

LCNUMBERF_PACKED

Source numeric/decimal data is packed.

LCNUMBERF_BIT

Source type is a bit.

Size: size, in bytes, of this number value. Zero indicates to default to the size of the type for this field.

Precision: digits of precision for this value. Zero indicates not used.

Scale: numeric scale. A true scale of zero uses the constant LCSCALE_ZERO. Zero indicates not used.

Datetime (DATETIME)

Size: size, in bytes, of this datetime value. Zero indicates to default to the size of the type for this field.

Flags: zero or more of the following constants. Multiple constants can be ORed together:

Constant

Description

LCDATETIMEF_NO_DATE

Source type is time only.

LCDATETIMEF_NO_TIME

Source type is date only.

Stream (TEXT, BINARY)

Flags: zero or more of the stream flags LCSTREAMF_xxx. Multiple flags can be ORed together. See the LCStream class description.

MaxLength: maximum length, in bytes, of this stream value. Zero indicates no maximum length. See the LCStream class description.

StreamFormat: default stream format for this stream value. Zero indicates no default stream format. Use one of the LCSTREAMFMT_xxx constants.

Field Virtual Codes -- Advanced Usage

Virtual codes allow specific fields to be interpreted differently for Connectors which support virtual fields. For example, a Connector could support a virtual field named "RecordId," which holds a special internal record indicator for that Connector. This Connector would interpret this field differently than normal data, while other Connectors would consider this field a standard data field. While the virtual code indicates special handling, the field name determines the type of handling on a Connector-specific basis.

To achieve this functionality, the virtual code for a field is set to match either a Connector code or a Connection code. A Connector code is a code which is the same for all connections to a particular Connector in a Session. The Connector code can be obtained by retrieving the property LCTOKEN_CONNECTOR_CODE with LCConnection.GetProperty or as the code returned by LCSession.ListConnector or LCSession.LookupConnector. Using a Connector code as a virtual code causes all connections to that Connector to interpret the field as a virtual field. A connection code is a code which is different for all connections. The Connect code can be obtained by retrieving the property LCTOKEN_CONNECTION_CODE with LCConnection.GetProperty. Using a Connection code as a virtual code causes only that specific Connection to interpret the field as a virtual field. The Connector code can also be determined by taking the Connection code and zeroing the low two bytes (OR with LCMASK_CONNECTOR_CODE). Note that these codes are dynamically assigned and must be obtained for each execution of a script.

Processing Attachments Stored in RTF Fields

Notes® is primarily a document management system, not a relational database management system (RDBMS). Because of this, Notes® performs special handling for attachments stored in Rich Text fields. It stores the attachment data separately from the Rich Text field data. Currently you can only transfer attachments from Notes® to Notes®; Rich Text fields with attachments do not store correctly in the target RDBMS such as DBA and Oracle.

To work around this constraint, you can use the Notes® Connector option Extract File Attachments to save attachments to files on disk. You can then use LotusScript® to read the files, store their contents in LCFields, and save the LCFields to binary fields in a RDBMS. This level of scripting requires LotusScript® expertise.