Click or drag to resize
TOPICA Basic Class Record

[This is preliminary documentation and is subject to change.]

The Record class models one instance of a configured form (the data in one saved form) of patient record data. One form instance is stored in one database row, so there is a 1:1-relation between a Record object in TOPICA Basic and a row in one of the dynamically generated database tables.

Record properties

Property

Type

Description

TableName

String

The table name specified in DataName in The Structure File - this is also the name of the dynamically generated database table.

Equivalent to Table.TableName

Id

Integer

Internal ID of the record. Guarateed to be unique in each table.

I.e. the key of a record is TableName and Id.

Caption

String

The caption specified in property Caption in The Structure File and hence saved in the Data Dictionary.

DateCreate

DateTime

The system date/time when the record was created.

DateUpdate

DateTime

The system date/time when the record was LAST updated.

DateStart

DateTime

The value of the DATE_START column in the database table.

The value of this field is set whenever a record (form instance) is created or updated according to this algorithm:

  • If a DateStart computation is defined (in The Structure File), this computation is evaluated, and if the result has type DateTime, this value is used - else:

  • If one (and only one) DateTime field in the form has been marked as "DateStart", the value of this field is used - else:

  • The minimum value (i.e. earliest date/time value) of all DateTime fields in the form is used.

DateStop

DateTime

The value of the DATE_STOP column in the database table.

This value is automatically set to the current system date/time when a record is closed.

Closed

Boolean

The value of the STATUS_CLOSED column in the database table.

Closed status.

Completed

Boolean

The value of the STATUS_COMPLETE column in the database table.

Completed status.

Value true means, that all fields with FillInStatus not equal to "Optional" have been filled in (i.e. no fields are empty), AND that no errors or warnings were generated by any validation rule.

Table

DataDictionaryTable

The table the curent record belongs to.

Type

String

The StructureType defined in The Structure File

The TOPICA framework does not use this value for anything when generating Data Dictionary, i.e. the value does not have any influence on the dynamically generated database tables.

The value is used in the "Search Patient" dialog to group tables in logical groups. The user may optionaly display records belonging to tables having specified structure types. For example: the Data Dictionary may contain several tables, that all describe "encounters".

Equivalent to Table.Type

CreatedByEmployee

Obsolete alias: CreatedBy

Employee

The employee user that created this record - will be null if it was a logged in patient, that created the record.

UpdatedByEmployee

Obsolete alias: UpdatedBy

Employee

The employee user that last updated this record - will be null if the record has not been updated since it was created, or it was a logged in patient, that last updated the record.

EmployeeUser

Obsolete alias: User

Employee

If the record was last touched by a logged in employee, this property contains the employee user that last touched this record - i.e. equal to UpdatedByEmployee if the record has been updated, otherwise equal to CreatedByEmployee

record.EmployeeUser = if(IsNotNull(record.UpdatedByEmployee), record.UpdatedByEmployee, record.CreatedByEmployee)

CreatedByPatient

Patient

The patient user that created this record will be null if it was a logged in patient, that created the record.

UpdatedByPatient

Patient

The patient user that last updated this record - will be null if the record has not been updated since it was created, or it was a logged in employee, that last updated the record.

PatientUser

Patient

If the record was last touched by a logged in patient, this property contains the patient user that last touched this record - i.e. equal to UpdatedByPatient if the record has been updated, otherwise equal to CreatedByPatient

record.PatientUser = If(IsNotNull(record.UpdatedByPatient), record.UpdatedByPatient, record.CreatedByPatient)

OrgUnit

OrgUnit

Caution note Caution

Behvaior of this property depends on the whether "external relations" are in use.

  • In relases up to 4.22, "external relations" are not implemented.

    There is always one and only one relation from Record to OrgUnit (the so called "data ownership" relation),

    The value of the OrgUnit property will be the OrgUnit stored in that relation (the "data owner"). This value will be null if the configuration of the table is OrgUnitRelation=None (e.g. when the record is neither an encounter nor a subrecord to an encounter).

  • In releases 4.23 and later, it is possible to specify any number of (named) relations from Record to OrgUnit (the "exernal relations" feature). When the "exernal relations" feature is NOT used, OrgUnit works as above (as in earlier releases). When the "exernal relations" feature IS used, there are the following scenarios:

    • One of the relations to OrgUnit has blank name (the default, backward compatible relation). Then the value of the OrgUnit property will be the OrgUnit stored in that relation.

    • None of the relations have blank name - or you need to get the OrgUnit value in a named relation. In this scenario, you MUST supply the relation name as parameter.

      Example: Record.OrgUnit("MyRelation")

      If you specify the name of a relation, that is not defined on the table, an exception is thrown.

ParentRecord

Record

The "parent" record in the Patient Record Tree

Will be null if the record is directory below the root (= patient).

SubRecords

RecordCollection

All subrecords below this record.

RelationsFrom

RecordRelationCollection

All relations from this record to any other records.

Caution note Caution

Release 4.24 and newer only!

RelationsTo

RecordRelationCollection

All relations to this record from any other records.

Caution note Caution

Release 4.24 and newer only!

XXX (whatever)

Any

If the record contains a field with field name XXX (specified by DataName in the form) the value of this field is returned.

Type of the result obvioiusly depends on the type of field.

Note that since a configured field with DataName="XXX" is accessed with the syntax Record.XXX, you should not use any of the "fixed" property names for your configured fields. If, for example, you configured a field with DataName = "OrgUnit", you would not be able to get the value of that field in TOPICA Basic, as Record.OrgUnit would return the data owner of the record, not the value of your field "OrgUnit".

Record indexing

The Record class supports indexing by strings. The index value (i.e. the string) must be the name of a table, to which there is a 1:1-relation from the table of the current record (specified in The Structure File and saved in the Data Dictionary).

If Record.TableName = "TableX", and there is a 1:1-relation between TableX and TableY where TableX is the "parent" and TableY is the "child" - then the expression Record["TableY"] will return the record (form instance) of type TableY. The result is an object of type Record, if the child form has been filled in, and null if the child form has NOT been filled in.

Example:

if(IsNull(Record["TableY"], "Form Y has not been filled in", "Value of form Y, field Z: " + Record["TableY"].Z)