infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
how to filter message based on patient gender?
System
Originally posted by Amdy Diene
I need a simple TCL script to filter patient based on gender.
Find more posts tagged with
Clovertech
Comments
Sean Farley
The following code would filter off all messages where the gender is male. Or to be more technical, where the PID:8 value is "M"
If you have any questions, let me know.
#########################################################################
# Name: gender_filter.tcl
#########################################################################
# Purpose: TCL proc to filter by gender.
#
# UPoC type: tps
#
# Args: tps keyedlist containing the following keys:
# MODE run mode ("start", "run", "time" or "shutdown")
# MSGID message handle
# CONTEXT tps caller context
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
# Note: All included routines "inc_" and global variables "gv_" are
# defined in the drmc_includes.tcl file
#
#########################################################################
# Last Update:
# Description:
#
#########################################################################
proc gender_filter { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
set iKillMsg 0 ;# Kill message indicator (0 = Send | 1 = Kill)
set iDebug 0 ;# Debug indicator ( 0 = Off | 1 = On )
switch -exact -- $mode {
start { }
run {
keylget args MSGID mh
# Set message variables
set msg [msgget $mh] ;# Original message
set fs [cindex $msg 3] ;# Field seperator
set sfs [cindex $msg 4] ;# Subfield seperator
set rfs [cindex $msg 5] ;# Repeating field seperator
set segs [split $msg r] ;# Split message into segments using CR
set newmsg {} ;# New message list
# Loop through segments
foreach seg $segs {
set fields [split $seg $fs] ;# Split the segment into fields
# Main Switch
switch [lindex $fields 0] {
PID {
set sGender [lindex $fields 8]
if { $sGender eq "M" } {
set iKillMsg 1
}
set seg [join $fields $fs]
lappend newmsg $seg
}
default {
lappend newmsg $seg
}
}
}
# Join the list with CR
set newmsg [join $newmsg r]
# Set the original message to new message
msgset $mh $newmsg
if {$iKillMsg == 1} {
# Kill Message
lappend dispList "KILL $mh"
} else {
# Send Message
lappend dispList "CONTINUE $mh"
}
}
time { }
shutdown { }
default { error "Unknown mode '$mode' in $module" }
}
return $dispList
}
System
Originally posted by Amdy Diene
Thanks
System
Originally posted by Steve Williams
Amdy,
I avoid using simple one off scripts for message filtering. Instead, I use a generic filter that uses arguments. That way, I have one script that can be reused over and over again. The script is considerably longer than a simple one, like the one posted by Sean. But the benefits highly out weigh the negatives. Send me PM if you'd like me to send you a copy of mine.