Please enable JavaScript to view this site.

HL7 C# Script Reference

 

This class object is passed into every script as the sole parameter of the main Execute(COREHL7Script parent) method. In all of the default CORE HL7 Scripts that we create we immediately assign the parent parameter to a globals object.

 

This class implements the COREException class for your convenience.     

 

 

Process Flow Properties and Methods:

 

Property Name

Data Type

Completed

bool - Will be false on script start and should be set to true by your script when processing completes.

StopAllProcessing

bool - Will be false on script start and will be set to true by the script hosting application if the Service needs to stop or the user requests it by clicking a Stop button. Long running scripts should query this property frequently to determine if the hosting application is trying to stop your script. See Example Scripts 1 and 3.

 

Method

Return Value

LogIt(string value)

void - Will log value into a daily log file stored in the LogFolder. If the LogFolder is not set or is invalid, nothing happens.

Sleep(int milliseconds)

void - Implements a thread block and wait, releasing CPU to other running threads (IE other scripts and Windows processes). Use this method in Default value for milliseconds 10. Minimum value for milliseconds is 5 and the maximum value is 1000. Example: calling globals.Sleep(); in your script code will thread block for 10 milliseconds.

Trace(string value)

void - Generates a Trace event which the Script Hosting Application (See Architecture) will display value in a runtime window if running locally OR if using the CORE HL7 Viewer

TraceLog(string value)

void - Shortcut method that calls both Logit() and Trace() passing value into both.

 


Public Files and Folders:

NOTE: These properties are overridden in a CORE Script Engine with your Engine Profile values.

Property Name

Data Type

ErrorFolder

string - Will be the Errors Folder defined in your script additional properties

LogFolder

string - Will be the Logs Folder defined in your script additional properties

OutputFolder

string - Will be the Output Folder defined in your script additional properties

ConfigFileName

string - Will be the Configuration File Name defined in your script additional properties

 

Method

Return Value

SuggestedFileTitle(string ext = "hl7")

SuggestedDailyFileTitle(string ext = "hl7")

string- Returns a unique file title with the file extension set to ext. The title is formed as <ScriptShortID>.<DateTimeStamp to the millisecond + rolling 4 digit number >.<ext>

SuggestedDailyFileTitle() returns a unique file for the current DAY of the year. The title is formed as <ScriptShortID>.<DateStamp>.<ext>

 

 


HL7 Message Properties and Methods:

 

Property Name

Data Type

DisplayVersion

string (read-only) - Will be the script version.

InitialHL7Message

string - Will be a full HL7 message in string form and is passed in through the Script Hosting Application (See Architecture).

Utilities

COREScriptUtilities - Will be an instantiated COREScriptUtilities object.

 

Method

Return Value

CommitMessage(CHS_Message msg)

void - When called it will take the appropriate action based on the Script Hosting Application. Typically this would be the last method you call when your script has finished with a HL7 message before exiting. In the CORE HL7 Viewer calling CommitMessage() updates the corresponding value in your Message Store. In a CORE HL7 Script Engine calling CommitMessage() causes a HL7 data file containing msg to be created in OutputFolder using the SuggestedFileTitle().

CreateInitialMessage()

CHS_Message - When called it will create a CHS_Message object from the InitialHL7Message string value. If the InitialHL7Message is not a valid HL7 message string or is empty it will return null. and the LastException will be set.

CreateNewMessage(string value = "")

CHS_Message - When called it will create a new CHS_Message object. You can pass a fully formed HL7 Message string in the optional value parameter (if you do and the string cannot be parsed will return null).

 


MoveInitialMessageToError()

bool - When called it will create a data file in the ErrorFolder containing the InitialHL7Message value. It uses the SuggestedFileTitle() method to generate the file name. Returns false if InitialHL7Message is empty or the ErrorFolder property is invalid, inaccessible, or not set.

NewMessageControlID()

string- Returns a 20 character HL7 compliant message control id suitable for use in MSH 10.1

 

 


 

MS SQL and MySQL Database Connectors:

 

NOTE: The Microsoft SQL and MySQL Connectors that are configured in your script will be OVERRIDDEN when using the CORE HL7 Script Engine software in your CORE HL7 Script Engine profiles. See the online help for the script engine.

 

Property Name

Data Type

MSSQLProfile

COREScriptSQLConnector - Access your Microsoft SQL Server database. This property will either be null OR a COREScriptSQLConnector object.

SQLConnectionString

string - IF SQLConnectorIsValid it returns the Connection String we use to access the Microsoft SQL database, otherwise it returns an empty string.

SQLConnectorIsValid

bool - Returns true if the MSSQLProfile has all required properties completed. If not OR MSSQLProfile is null it returns false. NOTE: This only verifies that the MSSQLProfile has values properly completed, it does NOT mean that those values are valid. For instance you can create a COREScriptSQLConnector using AAAA as the server name and BBBB as the database name.

SQLConnectorXML

string- Returns a string XML representation of the MSSQLProfile. or an empty string if not SQLConnectorIsValid.

MySQLProfile

COREScriptMySQLConnector - Access your Microsoft SQL Server database. This property will either be null OR a COREScriptMySQLConnector object.

MySQLConnectionString

string - IF MySQLConnectorIsValid it returns the Connection String we use to access the MySQL database, otherwise it returns an empty string.

MySQLConnectorIsValid

bool - Returns true if the MySQLProfile has all required properties completed. If not OR MySQLProfile is null it returns false. NOTE: This only verifies that the MySQLProfile has values properly completed, it does NOT mean that those values are valid. For instance you can create a COREScriptMySQLConnector using AAAA as the server name and BBBB as the database name.

MySQLConnectorXML

string- Returns a string XML representation of the MySQLProfile or an empty string if not MySQLConnectorIsValid.

 

 

 


Under Construction Check Back Soon

Under Construction Check Back Soon

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC