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
pulling a specific phone number
Kevin Crist
I need to pull a field from a segmen with multiple phone numbers. i need to search for one and put it in front using tcl.
Example: This is field 10 of an STF segment.
|(888)451-3636CH~(812)887-4356CC~(747)787-0000CO~(812)884-8585CF~666CB~|
What i am wanting: ~(747)787-0000CO~(812)887-4356CC~(888)451-3636CH~(812)884-8585CF~666CB~|
The recieving system only takes the first number in the field and populates that number in its office phone number location. But that number isnt always the first number. It is the number witht he CO at the end. How can i search through the numbers and find the one with the CO if it exists and put it in the first position?
Here is what i have so far to pull out the phone fields:
set phone [lindex [split [lindex $STFList $STFPhoneNum] $repSep] 0]
Thanks for any help.
Find more posts tagged with
Clovertech
Comments
System
Originally posted by Chris Williams
Kevin,
You want to iterate through the repetitions of the field, and for each one of them test whether it contains "CO". If it does, then write the value out to the destination. If it doesn't, don't do anything. Go on to the next repetition.
Charlie Bursell
As stated you could maybe do this in Xlate. But if you want to do in Tcl
I'm a little confused as to what you want. Do you want to simply move the number to the front or replace what is in front with the number?
Assume you want to simply move number to front. Assume you have extracted the field to variable fld
set lst [split $fld $repSep]
set loc [lsearch -regexp $lst {CO$}]
if {$loc >= 0} [
set CO [lvarpop lst $loc]
set fld [concat $CO $lst]
}
set fld [join $fld $repSep]
If you want to replace first element with number then change
set fld [concat $CO $lst]
to
set fld [lreplace $lst 0 0 $CO]
Jim Kosloskey
Kevin,
This could be done in an Xlate as Chris indicated or in Tcl as Charlie indicated.
If you are using an Xlate you may need some Tcl. If you are on Cloverleaf 5.6 or later you won't need Tcl to test for the CO (assuming it can only occur once in each iteration) as I think the new contains (ct) string oerand will do the trick.
However if you want to take some portion of the telephone number then you will probably need some tcl for that.
Of course if the provider of the message had followed the standard (I am assuming version 2.3 or later) then this XTN data type for Phone should have had all the pieces of the telephone number (including the identifier of type of phone - which I assume the CO is) in their proper components and then you would probably not need any Tcl in the Xlate.