In this scenario, the goal is to check whether a patient is being admitted or discharged. If the patient is being admitted, then their details need to be inserted into a table. If they are being discharged, then their details should be removed from the table. Conditional execution of the appropriate statements in the Database Configuration file of the filter are used to achieve this goal.
Database Configuration File
The database configuration file contains the database details, and specifies where the conditional execution occurs.
For this example, it is assumed that earlier in the route a message property ($messageEvent
) has been set to be admit
or discharge
. In the database configuration file example below, the value of $messageEvent
is tested as equal to Admit
or Discharge
. If the value is Admit
, then the SQL statement is run, which inserts a row into the table (patientLocationTable
). If the value is Discharge
, then a second SQL statement is run which deletes a row from the table.
In this example, EQUALS()
has been used to perform the conditional execution.
Multiple Parameters
You can also perform a conditional execution on database fields. For example, you can compare a message property with a database field: EQUALS($messageEvent, @databaseField)
.