Skip to main content


abstract persistent class HSMOD.CSVTable.AbstractTable extends %Library.Persistent

SQL Table Name: HSMOD_CSVTable.AbstractTable

Base class for tables with CSV import/export functionality.

This would be particularly useful for any set of (persistent) data that drives behavior but has very low churn or turnover, including tables whose contents might be managed by customers or implementers, possibly using external code dictionary/mapping software.

In order for the import/export code to work, we handle object references by replacing the object property with simple values from the target class's primary key. We do this for any property whose type does not begin with a % symbol; if this is too broad we can restrict it to other subclasses of this class.

The import/export features rely on explicit SqlColumnNumber values for every (persistent) property in the class. Column number 1 is internal, and column numbers 2 and 3 are used by this base class. Thus, a table class extending this class would begin with column 4 for its properties.

This class is subject to change in future versions of HealthShare.


Property Inventory

Method Inventory


property LastModified as %TimeStamp;
computed field (automatically populated), containing the most recent modification date/time.
Property methods: LastModifiedCompute(), LastModifiedDisplayToLogical(), LastModifiedGet(), LastModifiedIsValid(), LastModifiedLogicalToDisplay(), LastModifiedNormalize(), LastModifiedOdbcToLogical(), LastModifiedSQLCompute(), LastModifiedSet(), LastModifiedSetT()
property UniqueIdentifier as %String (MAXLEN = 200);
optional unique identifer; each table has a unique index on this property. It is not used by the functional code, and is purely an aid to data management
Property methods: UniqueIdentifierDisplayToLogical(), UniqueIdentifierGet(), UniqueIdentifierIsValid(), UniqueIdentifierLogicalToDisplay(), UniqueIdentifierLogicalToOdbc(), UniqueIdentifierNormalize(), UniqueIdentifierSet()


classmethod DescribeFileFormat()

Outputs a description of the file format for the table, to aid users in import/export file prep. Intended to be run from Terminal. Writes output directly to the current device.

classmethod ExportToFile(pFilename As %String, pOverwriteExisting=0, pAddHeaderRow As %Boolean = 0, Output pResultInfo As %String) as %Status

Utility method for exporting table contents to CSV. Run FileFormat() for a summary of the file format.


  1. pFileName: full file path and file name for file to export
  2. pOverwriteExisting: whether to overwrite any existing file by that name
  3. pAddHeaderRow: whether to include a header row containing column names
  4. pResultInfo: verbal confirmation of success or failure, with error contents or line count.

classmethod ImportFile(pFilename As %String, pRemoveExistingValues As %Boolean = 1, pRelyOnHeaderRow As %Boolean = 0, pLineLength As %Integer = $$$MaxLocalLength, Output pResultInfo As %String) as %Status

Utility method for importing table contents from CSV. Run DescribeFileFormat() for a summary of the file format.


  1. pFileName: full file path and file name for file to import
  2. pRemoveExistingValues: whether to wipe out the current contents of the file before importing. If true, then dependent data in downstream tables will be cleared as well.
  3. pRelyOnHeaderRow: whether to expect a header row with column names in the file.
  4. pLineLength: the maximum length to read per line. If omitted, we use the string length limit for the current server.
  5. pResultInfo: verbal confirmation of success or failure, with error contents or line count.



index (UNIQUEIDIX on UniqueIdentifier) [Unique];

Inherited Members

Inherited Methods


FeedbackOpens in a new tab