Previous Topic

Next Topic

Book Contents

Book Index

MemoryTableBuilder Object

You can create a memory table using MemoryTableBuilder object to define properties. Once defined, a Memory Table object is created by calling the CreateTable method.

Using Memory Table Builder Object

The type of data stored in the field affects the disk storage each field occupies. See Table Field Types for field types available.

MemoryTableBuilder object has the following methods to allow definition and manipulation of memory table properties:

Method

Description

AddField

Add a new field to the table definition.

AddIndex

Add a new index to the table definition.

Clear

Clear all fields and index definitions.

ClearFields

Clear all field definitions.

ClearIndexes

Clear all index definitions.

Clone

Copy the field and index definitions from another table.

CloneField

Copy a field from another table.

CreateTable

Create a new memory table.

GetPropertyValue

Return the value of a property or MaxBasic variable.

PropertyType

Return the type of the property.

SetPropertyValue

Set the value of a property or MaxBasic variable.

All fields in the MemoryTableBuilder object can be accessed as an object, and properties can be modified. Additional field properties are accessible via the AddField method. This also allows field properties to be modified using the Clone method to provide a set of fields for MemoryTableBuilder. Properties available on each field are:

Property

Type

Description

Alignment

Number [Integer]

Alignment to use for a grid or report displaying this field.

DisplayLabel

String

Field caption to use for a grid or report displaying this field.

DisplayWidth

Number [Integer]

Width in characters for a grid or report field displaying this field.

FieldName

String

Name of the field. Must be a valid MaxBasic identifier (Read Only).

Format

String

Format for numeric fields. This allows you to format numeric fields. For example, "0" will display the numeric field without formatting or decimals; "0,000.00" will display the field with comma thousand breaks and two decimal places.

FormatMode

Number [Integer]

0 = Default.

1 = Zero to Null (i.e. Blank Zero if reporting / saving to file).

2 = Null to Zero.

Group

Number [Integer]

Group number for field when reporting.

Index

Number [Integer]

What number field is this. Ranges from 0 to number of fields - 1.

ReadOnly

Boolean

When False, the field is editable.

Required

Boolean

When False, the field is optional.

Size

Number [Integer]

Maximum size for string fields (ReadOnly).

Total

Boolean

Total this field on reports (only valid for numeric fields).

Value

Variant

Value stored in the field.

Visible

Boolean

When True, the fields is visible in grids and reports.

MemoryTableBuilder Object Example

Dim Builder as Object
Builder = CreateObject("Accredo.MemoryTableBuilder")
Dim NewField as Object
NewField = Builder.AddField("Customercode", "Customer code")
NewField.Required = True
NewField = Builder.AddField("TotalAmount", "Amount")
NewField.FormatMode = 1
NewField = Builder.AddField("AnotherAmount", "Amount")
NewField = Builder.AddField("CurrencyCode","CO Currency Code")
NewField = Builder.AddField("Debit", "FX Amount")
NewField.CurrencyCodeField = "CurrencyCode"

Builder.AddIndex("code", "Customercode", True)
Dim Table as Object
Table = Builder.CreateTable

'You can generate documentation for the table using the DocumentObject function as shown:
DocumentObject(Table)

' Field properties can also be changed after tables have been created
' Field properties can be directly referenced by field name or by field index (0 based)
Table.Fields.Item("Debit").DisplayLabel = "Debit Amount"

Table.Fields.Item("Debit").Format = "0.00"
Table.Fields.Item(0).DisplayLabel = "Customer"

Memory Table Documentation Example

See Example Memory Table Documentation to view the documentation generated. The fields defined in the example code appear as properties on the object, and the index appears as a value that can be assigned to the IndexName property.

In This Section

Example Memory Table Documentation

Table Field Types

AddField - Memory Table Builder Method

Clear - Memory Table Builder Method

ClearFields - Memory Table Builder Method

ClearIndexes - Memory Table Builder Method

CloneField - Memory Table Builder Method

CreateTable - Memory Table Builder Method

GetPropertyValue - Memory Table Builder Method

PropertyType - Method

SetPropertyValue - Method