Pre and post procedures
Pre and post procedures are on different tabs, but use the same GUI, in the Action Properties panel.
In the Proc text field, the Tcl and Java procedures use the same text field.
- Select
Right-clicking in the field and clicking XLTP Properties dialog box.
opens the
to specify the Tcl
procedures into the text field and click the button to open the Tcl Script Editor. - Select Java Pre/Post Procedure Settings dialog box.
Right-clicking in the field and clicking Java Pre/Post Procedure Settings dialog box.
opens the
to specify Java
procedures. Click the button to
open the
Pre proc example
This example shows how to write a pre-procedure in a Translation Configurator COPY action. For example, pulling something from a source field, doing an operation on it, and storing it to the destination field.
A post procedure is similar.
#####################################################################
# Name: xltpDTTM
# Purpose: Convert HL7 DTTM to discrete fields for XML
# UPoC type: xltp
# Args: none
# Notes:
# This proc is to be used with the xmlNullConvert proc.
# The null convert proc adds the hex 166 in place of
# double quotes for active nulls.
# All data is presented through special variables. The initial
# upvar in this proc provides access to the required variables.
#
# This proc style only works when called from a code fragment
# within an XLT.
#
proc xltpDTTM {} {
upvar xlateId xlateId \
xlateInList xlateInList \
xlateInTypes xlateInTypes \
xlateInVals xlateInVals \
xlateOutList xlateOutList \
xlateOutTypes xlateOutTypes \
xlateOutVals xlateOutVals
set newlist ""
set aN [ctype char 166]
if {![string equal [lindex $xlateInVals 0] {}] } {
set iv $xlateInVals
if {[string equal [lindex $xlateInVals 0] [ctype char 166]]} {
set iv "$aN$aN$aN$aN$aN$aN$aN$aN$aN$aN$aN$aN$aN$aN"
}
set yrs [csubstr [lindex $iv 0] 0 4]
set mon [csubstr [lindex $iv 0] 4 2]
set day [csubstr [lindex $iv 0] 6 2]
set hrs [csubstr [lindex $iv 0] 8 2]
set min [csubstr [lindex $iv 0] 10 2]
set sec [csubstr [lindex $iv 0] 12 2]
if {![string equal $hrs $aN$aN] && $hrs > 24} {
set hrs 00
}
if {![string equal $min $aN$aN] && $min > 59} {
set min 00
}
if {![string equal $sec $aN$aN] && $sec > 59} {
set sec 00
}
set outputlist [list $yrs $mon $day $hrs $min $sec]
foreach element $outputlist {
if {[string equal $element {}] && ![string equal [lindex $xlateInVals 0] [ctype char 166]] } {
} else {
lappend newlist $element
}
}
set xlateOutVals $newlist
}
}