Table of Contents

Interface IRecordModel

Namespace
PushTechnology.ClientInterface.Data.Record.Model
Assembly
Diffusion.Client.dll

IRecordV2 data model.

public interface IRecordModel

Remarks

A read only model can be created from any IRecordV2 object using the AsModel(ISchema) method. The model then provides direct access to the fields within the data. Fields may be accessed either by explicitly specifying the record and field occurrence or by specifying a key of the form: "RecordName(RecordIndex).FieldName(fieldIndex)".

Indexes start from 0 and if omitted then 0 is assumed. The record name may also be omitted, in which case the first record definition will be used. This form of addressing is useful when there is only one record definition.

So valid keys would be:

Key Description
Address(4).AddressLine(3) The 4th AddressLine occurrence within the 5th Address record.
Address.Name The first (or only) Name field within the first (or only) Address record.
AddressLine(1) The 2nd AddressLine field within the first (or only) record.
Name The first (or only) Name field within the first (or only) record.

The RecordCount(string) and FieldCount(string, int, string) methods are useful for determining the actual number of occurrences of variable multiplicity items.

Implemented in Version 6.0.

Methods

AsValue()

Creates an immutable IRecordV2 object generated from the model.

IRecordV2 AsValue()

Returns

IRecordV2

The new immutable IRecordV2 object.

FieldCount(string, int, string)

Returns the actual number of occurrences of a named field within a specified record occurrences.

int FieldCount(string recordName, int recordIndex, string fieldName)

Parameters

recordName string

The record name.

recordIndex int

The record index.

fieldName string

The field name.

Returns

int

The actual number of occurrences of the field.

Remarks

For all but variable fields this simply returns the schema defined number of occurrences of the field.

Get(string)

Returns a field value.

string Get(string key)

Parameters

key string

The field key.

Returns

string

The field value.

Remarks

This allows an item to be addressed using a key of the form "RecordName(RecordIndex).FieldName(FieldIndex)". Indexes may be omitted in which case 0 is assumed. The record part may also be omitted in which case the first occurrence of the first record is assumed.

Get(string, int, string, int)

Returns a field value.

string Get(string recordName, int recordIndex, string fieldName, int fieldIndex)

Parameters

recordName string

The name of the record.

recordIndex int

The index of the record.

fieldName string

The name of the field.

fieldIndex int

The index of the field.

Returns

string

The field value.

RecordCount(string)

Returns the actual number of occurrences of a named record.

int RecordCount(string recordName)

Parameters

recordName string

The record name.

Returns

int

The actual number of occurrences of the record.

Remarks

If the record is not variable, this is the same as the defined number of occurrences in the schema.