Question
· Jan 5, 2021

Rule to evaluate if a value exists in a table

I have a operations that is writing 6 values to a table 

Class BHS.Custom.MosaiqCloudPatientsTable Extends (%Persistent, Ens.Request) [ Inheritance = right ]

 

I need to create a routing rule to evaluate a field in an hl7 ORU message ,  see if it exists in the account column of the table. If it does then allow the message to pass.

This table is not a lookup table. How can I get a function to evaluate a field to this  table?

Product version: HealthShare 2017.2
$ZV: Cache for UNIX (IBM AIX for System Power System-64) 2017.2.2 (Build 867_4_20402U) Mon Oct 26 2020 20:07:06 EDT [HealthShare Modules:Core:15.032.9692 + Linkage Engine:15.032.9692]
Discussion (1)0
Log in or sign up to continue

Hope this satisfies your need:

I created a new class (called Test.Common.Utility) to do this.  It performs a simple SQL select on a %Persistent table to find a specific value in a column.  The code is as follows:

Include EnsHL7
Class Test.Common.Utility Extends Ens.Rule.FunctionSet
{
ClassMethod CheckTable(pCSN As %String) As %Boolean
{
    Set output = $$$NO
    
    &SQL(Declare C11 Cursor for select CSN into :tCSN from Test_Record.SampleTable where (CSN = :pCSN))
    &SQL(Open C11)
    &SQL(Fetch C11)
    if SQLCODE = 0 { Set output = $$$YES }
    &SQL(Close C11)

    Quit output
}
}

My rule to implement this function looks like: