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
Cloverleaf
check field for numeric value
jdInforComm
Hello - I'm checking a field for numeric value. If the field is numeric (integer or double) then I need to clear another field in the hl7 message.
The inline code is fine up to the point where I try to assign the outcome of the check of the numeric value. The outcome of the check (0 or 1) is not passed to $xlateOutVals. What am I doing wrong? Is there a better way to check the field for a numeric value?
Inline code below with debug and all, and some comments. Testing with numeric field = 111.111
set out $xlateInVals // out is 111.111
#set out [string is integer -strict $xlateInVals]
#echo WHAT IS OUT ****** $out
if {[string is double -strict $out]} { /// return 1 if numeric
echo OUT is numeric $out // prints 1
set out "1" // explicitely setting out
echo NEW OUT is numeric $out // prints 1
set $xlateOutVals $out // keeps what is in $xlateInValues
echo NEW XOUTVALS $xlateOutVals // prints 111.111
} else {
echo OUT is NOT numeric $out
set out "0"
echo NEW OUT is NOT numeric $out
set $xlateOutVals $out
}
#set $xlateOutVals $out
Thank you in advance.
Find more posts tagged with
Clovertech
Comments
Jim Kosloskey
First, xlateInxxx and xlateOutxxx are lists and should be treated as such using list commands to reference.
Mostly, though - I think, is this command:
set $xlateOutVals $out
should be set xlateOutVals $out (no $ in front of xlateOutVals), But using a list command like lreplace would be better.
jdInforComm
Hello - thank you! Removing the $ from xlateOut* did it. Point about lists and lreplace noted. JD
Charlie Bursell
Just a point. You can tighten up your code quite a bit.
An integer can qualify as a double but not vice versa. So:
set xlateOutVals [ list [string is double -strict [lindex $xlateInVals 0]]]