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
Calculation Patient's Age
Mike (Clovertech)
Hello Folks,
I have an application that wants me to look at DOB (PID-7) if it is less than 18 years old (minor) I need to set a flag in the message.
I have an Xlate in between and can use TCL.
Thoughts on the leanest way to slide it in the Xlate
Thank you
Find more posts tagged with
Clovertech
Comments
jnelson
This is how I've done it in the past. It may not be THE leanest way, but it's pretty lean and works.
<pre>set DOB CCYYMMDD ;# Set DOB to the date of birth from the message
if {[clock scan "today -18 years"] < [clock scan $DOB -format "%Y%m%d"] {
# put your actions here
}</pre>
Keith McLeod
Can you use something like
if {[expr ([clock scan today] - [clock scan "YYYYmmdd 000000"])/86400/365] < 18} {
set flag here
}
Mike (Clovertech)
Thank you James!
Mike (Clovertech)
Thank you Keith
Paul Bishop
I've done it were I calculate the date
n
number of years ago (11 years in my example) and then just compare the DOB in the message to that calculated date to set a flag.
input is the PID-7 field, output is a variable used as a flag (
@underage_flag
in my case)
lassign $xlateInVals dob_date
# get yr, m and day only
set temp_date [string range $dob_date 0 7]
# todays date minus 11 years
set todays_date [clock format [clock scan " - 11 years"] -format "%Y%m%d"]
# compare dates - if birthdate less than calculated todays date, use patient
if {$dob_date < $todays_date} {
set out_flag N
} else {
set out_flag Y
}
set xlateOutVals [list $out_flag]