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.
Property | Type | Version | Description | ||
---|---|---|---|---|---|
Table | The table the 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 | |||
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 | |||
Caption | String | The caption specified in property Caption in The Structure File and hence saved in the Data Dictionary. Equivalent to Table.Caption | |||
Id | Integer | Internal ID of the record. Guaranteed to be unique in each table. Autogenerated (incremented) upon insertion in database table. The key of a record is (TableName, Id). | |||
DateCreate | DateTime | The system date/time when the record was created. | |||
DateUpdate | DateTime | The system date/time when the record was LAST updated. | |||
DateDelete | DateTime | 4.31+ | Date/time for logical deletion - null if NOT logically deleted. | ||
Deleted | Boolean | 4.31+ | Whether the record is logically deleted. | ||
DeletedByEmployee (alias DeletedBy) | 4.31+ | The employee user that logically deleted this record. | |||
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:
| |||
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. | |||
CreatedByEmployee Obsolete alias: CreatedBy | 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 | 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 | 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 | 4.24+ | The patient user that created this record will be null if it was a logged in patient, that created the record. | |||
UpdatedByPatient | 4.24+ | 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 | 4.24+ | 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) | |||
Patient | 4.30+ | The patient to which the record belongs. There is a global variable Patient (holding the patient in context), and a record is nomally only handled when the patient that "owns" the record is in context. In most cases Record.Patient = Patient. So why is Record.Patient needed? Because it is possible to "customize" values of fields when records are "merged" from one patient to another (by using the SetValueOnCopy property, that may be specified on all form elements generating fields in the database). Merging two patients involves copying records from one patient to another. Field values in records are per default copied unchanged. But in some situations field values should NOT be just copied (they should be set to a new fixed or computed value). The SetValueOnCopy property may hold a TOPICA Basic expression - whn this is presnet, it is valuated, and the result will be the field value in the copied record. During the "merge" operation there are 2 patients involved:
For an example - see demo application DemoPatientMerge. | |||
OrgUnit | NOTE: |
| |||
ParentRecord | The "parent" record in the Patient Record Tree Will be null if the record is directly below the root (= Patient). | ||||
SubRecords | All subrecords (= "child" records) below this record. | ||||
RelationsFrom | 4.24+ | All relations from this record to any other records. | |||
RelationsTo | 4.24+ | All relations to this record from any other records. | |||
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 obviously depends on the type of field.
|
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)