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
Tcl Library
continue through loop
Kevin Crist
we have a tclproc that goes through all the dr fields and pads with 0's up to 5 long. So if a number is 123 it makes it 00123. Apparently in the dr fields they can have "" in the field and the proc just puts 000"" but apparently this messes up the document in the application. How would i put in the change that if that field is "" then just leave it or else change it. I have messed around with regexp, continue, break and a few others trying to get it going. Any tips on how to do this.
proc FormatDrNum { DrFldList subSep } {
set i 0
foreach Dr $DrFldList {
set subfldList [split $Dr $subSep]
lset subfldList 0 [format "%05s" [lindex $subfldList 0]]
lset DrFldList $i [join $subfldList $subSep]
incr i
}
return $DrFldList
}
Find more posts tagged with
Clovertech
Comments
Jim Kosloskey
Kevin,
Maybe something like this:
proc FormatDrNum { DrFldList subSep } {
set i 0
foreach Dr $DrFldList {
set subfldList [split $Dr $subSep]
if {[string equal [lindex $subfldList 0] ""]} {
break
}
lset subfldList 0 [format "%05s" [lindex $subfldList 0]]
lset DrFldList $i [join $subfldList $subSep]
incr i
}
return $DrFldList
}
Kevin Crist
thanks Jim, but i am getting an error now, i will post the whole proc. From what i am understanding is that if i do a break then it will jump completely out of the loop, is that true? If so that is not what i want. Since this checks all possible dr fields in hl7.
Thanks
0:TEST] Tcl error:
msgId = message0
proc = 'tpsSoft_DrNum_In'
args = ''
result = 'wrong # args: should be "string equal ?-nocase? ?-length int? string1 string2"'
errorInfo: '
wrong # args: should be "string equal ?-nocase? ?-length int? string1 string2"
while executing
"string equal [lindex $subfldList 0]"""
(procedure "FormatDrNum" line 5)
invoked from within
"FormatDrNum $repList $subSep"
("PV1" arm line 16)
invoked from within
"switch -exact [lindex $fldList 0] {
PD1 {
if { [llength $fldList] >= [expr $PrimaryPos + 1] } {
;# 1) Get ..."
("foreach" body line 16)
invoked from within
"foreach segPos $PosList { ;# For Each Seg in List
if { $segPos > 0 } { ;# If the Segment was found
;# Spli..."
("run" arm line 25)
invoked from within
"switch -exact -- $mode {
start { }
run {
set mh [keylget args MSGID] ;# Get message handle from args
set dispList [list "CON..."
(procedure "tpsSoft_DrNum_In" line 52)
invoked from within
"tpsSoft_DrNum_In {MSGID message0} {CONTEXT sms_ib_data} {ARGS {}} {MODE run} {VERSION 3.0}"'
Max Drown
foreach line $var {
foreach line $var {
Charlie Bursell
In Jim's proc make sure there is a space between [lindex $subfldList 0] and "".
Change break to continue and it should work.
FTI. Instead of if {[string equal [lindex $subfldList 0] ""]} {
You could use (Less typing)
if {[lindex $subfldList 0] eq ""} {
Max:
Do you use regexp and regsub for *EVERY* thing
Kevin Crist
thanks all for your insights and knowledge. I was able to get this working correctly.
Max Drown
Charlie Bursell wrote:
Max:
Do you use regexp and regsub for *EVERY* thing
Charlie Bursell
Don't take it pesonal Max, I was kidding with you
Like most programming it is mostly a matter of personal preference.
There are only two people that write good code, me and you and sometimes i wonder about you!
Max Drown