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
trimming a number
Kevin Crist
i know i am missing something simple... i have tried the string range command to drop a few digits at end of a number.
For example:
123456201109 to 123456
123201109 to 123
I want to drop the 201109 at the end of the numbers, which is year/month. But the number in front can be 5,6 or 7 long and then year/month so that varies. How do i drop the last 6 digits?
Thanks for any advice.
Find more posts tagged with
Clovertech
Comments
jcobane1
Kevin,
Try this:
set mynum 123456201109
set mynewnum [string range $mynum 0 end-6]
The "end-6" will get to the position preceding the last 6 characters.
Hope this helps
Jim Cobane
Henry Ford Health
Kevin Crist
wow, do i feel dumb. Worked like a charm.
Thanks a bunch.
System
Originally posted by Kirby Knight
What is the best way in a translate pre proc to pass only the number along.
input value: Kirby12345
output value: 12345
System
Originally posted by Kirby Knight
I think I got it.
regsub -all {[A-Za-zs]} $xlateInVals "" xlateOutVals
Jim Kosloskey
Kirby,
xlateInVlas and xlateOutVals are lists.
To be absolutely safe you should use list commands when referencing those variables (Like lindex or lassign for xlateInVals or lreplace for xlateOutVals).
System
Originally posted by Kirby Knight
So this is what I have now.
regsub -all -- {[A-Za-zs]} [lindex $xlateInVals 0] {} tmp; set xlateOutVals
Charlie Bursell
More succiently
set xlateOutVals [list [regsub -all -- {[^d]} [lindex $xlateInVals 0] {}]]
:-)
System
Originally posted by Kirby Knight
Ok Charlie,
Can you explain to me what you are doing here?
It appears you are only letting numbers pass through by using d. Is it the ^ thats the key?
set xlateOutVals [list [regsub -all -- {[^d]} [lindex $xlateInVals 0] {}]]
Charlie Bursell
the ^ in front of d means negate it. It says change everything but numbers to the empty string
System
Originally posted by Kirby Knight
ah ha!
Thanks Charlie,
Much cleaner and more precise.