Originally posted by Anonymous
Originally posted by Sergey Sevastyanov
Tcl callout errorerroCode: NONEerrorInfo:can't read "db": no such variable while executing"$db $queries(stmt_$qryname) $queries(args_$qryname) $qryparms" (procedure "par_sql::run_qry" line 12) invoked from within"par_sql::run_qry get_culture_exam_quantity [list $visit_ext_id $order $child_order $seq" (procedure "get_ce_qnty" line 50) invoked from within"get_ce_qnty"
####################################################################### Name: get_ce_qnty - get Culture Exam quantities from SQL database# Purpose: # UPoC type: xltp# Args: none# Notes: 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.## This proc called from within Xlate and the following fields are passed into it:## Visit External Id - patient visit number# Paragon Order Number - first four digits are order#, the rest are child order## Culture Exam Sequence number#package require par_sql proc get_ce_qnty {} { global db global access_paragon set data_source_name paragon_puwt set ignore_errors 1 par_sql::setDebug 1 if {![info exists db]} { # try to connect to paragon db if {[catch {par_sql::connect $data_source_name} err_msg]} { if {$ignore_errors} { set access_paragon 0 echo $err_msg } else { set access_paragon 0 error $err_msg } } else { set db $err_msg set access_paragon 1 } # if can't access db - just return if {!$access_paragon} { return } } upvar xlateId xlateId xlateInList xlateInList xlateInTypes xlateInTypes xlateInVals xlateInVals xlateOutList xlateOutList xlateOutTypes xlateOutTypes xlateOutVals xlateOutVals set visit_ext_id [lindex $xlateInVals 0] set par_order [lindex $xlateInVals 1] set seq [lindex $xlateInVals 2] set order "*" set child_order "*" regexp -- {(d{4})(d{1,4})} $par_order -> order child_order### echo "visit# $visit_ext_id"### echo "order $order/$child_order"### echo "seq $seq" set cult_exam [par_sql::run_qry get_culture_exam_quantity [list $visit_ext_id $order $child_order $seq]]### echo "culture exam: $cult_exam" # return result - quantity is in 1st element of the returned list; seq - in 2nd set ce_quantity [string trim [lindex [lindex $cult_exam 0] 0]] xpmstore $xlateId [lindex $xlateOutList 0] c $ce_quantity }