This document provides information about user defined functions (UDFs) in TrakCare. UDFs allow site-specific logic to be added. A UDF has two parts: a definition specifying the class, event, and cache script; and the cache script routine. UDFs can be exported and imported. Common events include OnBeforeSave to add logic before record updates and OnNew to populate default fields. The document provides examples of using UDFs to interact with records, identify components, and print reports.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
220 views
TrakCare User Defined Functions
This document provides information about user defined functions (UDFs) in TrakCare. UDFs allow site-specific logic to be added. A UDF has two parts: a definition specifying the class, event, and cache script; and the cache script routine. UDFs can be exported and imported. Common events include OnBeforeSave to add logic before record updates and OnNew to populate default fields. The document provides examples of using UDFs to interact with records, identify components, and print reports.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 25
System Management
TrakCare User Defined Functions
Printed 16/07/2007 10:28 AM Changes 16/08/2002 Initial release 10/0/2002 Added UDF !ro"ra##in" $ %a#&les 28/10/2002 Added 'n(a)*&isode e+ent 12/11/2002 ,estructured and added #ore UDF !ro"ra##in" 12/12/2002 Identif-in" .orklfo/s $ 0as!rinted Met1od 22/06/2002 Added Co#&uter3a#e $ 4et!rinter #et1ods 15/06/2002 Added I#&le#entin" UDFs 11/08/2002 Added 'n*&isodeDe&osit to *+ent ta)le 16/08/2002 Added 'nAd#3o4en to *+ent ta)le 27/10/2006 Added #s"7AddIte# o)8ect descri&tion T1e infor#ation disclosed 1erein are confidential and &ro&rietar- to Inter%-ste#s7 T1is infor#ation #a- not )e used or disclosed to an- t1ird &art- for an- &ur&ose ot1er t1an t1at s&ecificall- aut1orised in /ritin" )- Inter%-ste#s7 TrakCare User Defined Functions Table of Contents Summary......................................................................................................................................... 4 Pre-requisites................................................................................................................................. 4 References...................................................................................................................................... 4 UD Definition................................................................................................................................ ! Class 3a#e7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 5 *+ent77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 6 Cac19%cri&t7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 7 "#$orting % &m$orting User Defined unctions...........................................................................' *:&ortin" UDF Definitions fro# Cac1e e:&lorer7777777777777777777777777777777777777777777777777777777777777777777777777 *:&ortin" UDF ,outines fro# Cac1e *:&lorer777777777777777777777777777777777777777777777777777777777777777777777777778 I#&ortin" UDF Definitions fro# Cac1e *:&lorer777777777777777777777777777777777777777777777777777777777777777777777778 I#&ortin" UDF ,outines fro# Cac1e *:&lorer77777777777777777777777777777777777777777777777777777777777777777777777777 *:&ortin" UDF routine fro# TrakCare777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 I#&ortin" UDF ,outines fro# TrakCare .e)7777777777777777777777777777777777777777777777777777777777777777777777777777 &m$lementing UDs...................................................................................................................... () UD Programming % Sam$les.................................................................................................... () 'n%;(Tri""er7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 10 *n+eforeSa,e.............................................................................................................................. (( 0o/ to &o&u& an *rror #essa"e in 'n<efore%a+e=7777777777777777777777777777777777777777777777777777777777777711 0o/ to &o&u& a .arnin" #essa"e in 'n<efore%a+e=7777777777777777777777777777777777777777777777777777777777712 msg.-dd&tem *b.ect.................................................................................................................... (/ ClassMet1od777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 12 *n0e1........................................................................................................................................... (4 0o/ to default fields in t1e 'n3e/ e+ent=7777777777777777777777777777777777777777777777777777777777777777777777777777716 &dentifying Com$onents % 2or3flo1s........................................................................................ (! 0o/ to identif- a s&ecific co#&onent=77777777777777777777777777777777777777777777777777777777777777777777777777777777777715 0o/ to identif- a s&ecific /orkflo/=777777777777777777777777777777777777777777777777777777777777777777777777777777777777777715 0o/ to identif- a s&ecific /orkflo/ ite#=7777777777777777777777777777777777777777777777777777777777777777777777777777777715 TrakCare Tec1nical Docu#entation 2 of 25 TrakCare User Defined Functions 0o/ to find out /orkflo/ ids=77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 16 Using Class *b.ects..................................................................................................................... (4 0o/ to in+esti"ate and u&date a record usin" class o)8ects=777777777777777777777777777777777777777777777777716 0o/ to read and u&date a #ulti>line field usin" class o)8ects=7777777777777777777777777777777777777777777777717 0o/ to use Desi"nati+e ,eference &ro&erties usin" class o)8ects=77777777777777777777777777777777777777718 5session % 5request *b.ects.................................................................................................... (6 0o/ to use t1e ?session o)8ect=77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777771 0o/ to use t1e ?re@uest o)8ect=77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 1 Printing7 Re$orting and "mailing................................................................................................8) 0o/ to &rint a re&ort=77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 20 0o/ to setu& &ara#eters for a re&ort=77777777777777777777777777777777777777777777777777777777777777777777777777777777777721 0o/ to c1eck if a s&ecific re&ort 1as )een &rinted )efore=777777777777777777777777777777777777777777777777777721 0o/ to &rint a re&ort if a !rint c1eck)o: is c1ecked=777777777777777777777777777777777777777777777777777777777777722 0o/ to sa+e a Cr-stal ,e&ort as a file=777777777777777777777777777777777777777777777777777777777777777777777777777777777722 0o/ to e#ail a #essa"e=7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 22 0o/ to !rint/*#ail a .ord Te#&late=777777777777777777777777777777777777777777777777777777777777777777777777777777777777726 Methods........................................................................................................................................ 84 0o/ to deter#ine t1e Co#&uter 3a#e fro# I! Address=777777777777777777777777777777777777777777777777777777726 0o/ to deter#ine /1at t1e Destination !rinter /ill )e fro# !rint Mana"er=7777777777777777777777777726 9anguage Reference.................................................................................................................... 8! 4etIdFro#Code'rDescri&tion7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 25 %et')8ectId777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 25 TrakCare Tec1nical Docu#entation 2 of 25 TrakCare User Defined Functions Summary User Defined Functions are Cac1e scri&t routines t1at &erfor# site>s&ecific lo"ic7 T1e anato#- of a UDF is #ade u& of t/o &arts: 1. T1e user defined function definition. 2. T1e user defined function Cac19%cri&t routineAsB7 I#&ortin" and e:&ortin" &rocedures re@uire e:&ortin" )ot1 &arts out to diskC and t1en restorin" fro# disk7 Pre-requisites 3one7 References 3one7 TrakCare Tec1nical Docu#entation 6 of 25 TrakCare User Defined Functions UD Definition UDFs are defined in t1e Side Menu-:Tool+o#-:UDs7 Click 3e/ to create a UDF7 A UDF definition is #ade u& of: Class 3a#e *+ent Cac1e UDF !ro"ra# Class 0ame T1e /e) &a"es t1at deli+er content are constructed fro# underl-in" Cac1e o)8ect classes defined )- TrakCare7 .1en t1e ne/C u&date or delete link on t1ese /e) &a"es are clickedC t1e a&&ro&riate #et1od of t1ese classes is in+oked7 A UDF e+ent )ranc1es out fro# t1is actionC and can take a nu#)er of &at1sC )ased on /1et1er one is deletin"C u&datin" or creatin" a ne/ record7 In order to deter#ine /1at t1e underl-in" Class na#e of a "i+en /e) &a"e isC do t1e follo/in": Call u& t1e s&ecific /e) &a"e/co#&onent to /1ic1 -ou /ant to add a UDF *nter t1e (a-out *ditor C1oose t1e #enu o&tion Tools D %;( *:&lorer to dis&la- t1e &ro&erties of t1e underl-in" class7 T1e title )ar of t1e /indo/ )ein" dis&la-ed is #ade u& of t1e letters EUser7classna#eF7 T1is is referred to as t1e full class na#e7 For e:a#&leC in t1e case of EUser7!AAd#FC t1e class na#e -ou /ould re@uire for -our UDF is !AAd#7 T1is a&&lies to all t1e e+ents e:ce&t t1e 'n%;(Tri""er e+ent7 Gou #ust use t1e full class na#e for all 'n%;(Tri""er e+entsC e7"7 User7!AAd#7 T1is also a&&lies to @uestionnaire co#&onents /1ere t1e full class na#e #ust )e used7 Also for /e)s-s classesC t1e classna#e -ou /ould re@uire for -our UDF is t1e sa#e as t1e ot1ersC e7"7 /e)s-s7,e&ortH,ef I t1e classna#e /ould )e ,e&ortH,ef7 TrakCare Tec1nical Docu#entation 5 of 25 TrakCare User Defined Functions ",ent T1e *+ent allo/s -ou to allocate different lo"ic a"ainst ne/ recordC e:istin" record or deletin" record u&dates7 Events ",ent Code Descri$tion Parameters 'n<efore%a+e T1is e+ent allo/s -ou to allocate s&ecific lo"ic t1at /ill )e e:ecuted before t1e /e) co#&onent is u&dated7 Id 'nAfter%a+e T1is e+ent allo/s -ou to allocate s&ecific lo"ic t1at /ill )e e:ecuted after t1e /e) co#&onent is u&dated7 id 'n3e/ T1is e+ent allo/s -ou to allocate s&ecific lo"ic t1at /ill )e e:ecuted before a 0"2 /e) co#&onent is dis&la-ed7 Use t1is #et1od to &o&ulate default +alues7 3one 'nDelete T1is e+ent allo/s -ou to allocate s&ecific lo"ic t1at /ill )e e:ecuted before the Delete link on a /e) co#&onent is clicked7 id 'n%;(Tri""er T1is e+ent is tri""ered /1ene+er a c1an"e occurs to t1e %;( ta)le t1at is re&resented )- t1e /e) classC i7e7 for e+er- I3%*,TC U!DAT* or D*(*T*7 4enerall- t1e %;( Tri""er /ill )e e:ecuted )efore t1e ot1er e+entsC i7e7 t1e %;( Tri""er e+ent for a deletion /ill )e tri""ered )efore t1e 'nDelete e+ent7 'n%ounde: Allo/s t1e user to /rite t1eir o/n site s&ecific +ersion of %ounde:7 T1e 'n%ounde: e+ent can onl- )e defined a"ainst t1e !A!erson class7 'n(a)*&isode T1is e+ent is tri""ered on t1e Insert of a (a) 'rder Ite# 'n*&isodeDe&osit Allo/s a default a#ount to )e defined /1en an e&isode s&ecific de&osit is )ein" created7 T1e 'n*&isodeDe&osit e+ent can onl- )e defined a"ainst t1e A,,ecei&ts class7 *&isodeID 'nAd#3o4en Allo/s a site s&ecific ad#ission nu#)er to )e "eneratedC function s1ould return t1e nu#)er7 T1e 'nAd#3o4en e+ent can onl- )e defined a"ainst t1e !AAd# class7 'nAuto!ack T1is auto#aticall- &acks &1ar#ac- ite#s t1at are sittin" in t1e &1ar#ac- @ueue and t1e lo"ic is )ased on +)7 Gou donFt need an- in&ut id for it7 'n<arCode T1is returns t1e oldest )atc1 and @t- /it1 t1e <arcode searc1 )arcodeC(oc 'nCusto#Dra/ Used )- Custo#Ite# on co#&onent:!A!erson7<anner &atientid 'n!atientDeceased T1is returns deceased &atient Es ad#ission data *&isode Id TrakCare Tec1nical Docu#entation 6 of 25 TrakCare User Defined Functions Cach;Scri$t A Cac19%cri&t routine is t1e Cac19 UDF &ro"ra# t1at /ill contain t1e lo"ic t1at /ill )e e:ecuted /1en a &articular e+ent is in+oked7 All user defined Cac19 &ro"ra#s #ust start /it1 t1e u&&ercase letter EUFC in order to a+oid t1e# )ein" o+er/ritten )- an- &atc1es Trak0ealt1 distri)utes7 All UDFJs s1ould follo/ t1e sa#e na#in" con+ention7 .e also su""est t1at t1e lo"ic for A(( e+ents for a class are &laced in t1e sa#e UDF Cac1e !ro"ra#C i7e7 Ke+entLMUKsiteL Kclassna#eL for e:a#&le: $$OnAfterSave^USITEPAAdm MU%IT*!AAd# is t1e na#e of t1e Cac1e%cri&t routine Ai7e7 U%IT*!AAd#7MACB and N N'nAfter%a+e is t1e ta"Ola)el inside t1e routine7 All Cac1e%cri&t na#es are case>sensiti+e7 Also -ou /ill find t1at -ou are not a)le to t-&e u&>arro/ c1aracter AMB in an- Te:t)o: in TrakCare7 Gou /ill need to t-&e t1e /1ole strin" in for e:a#&leC note&ad and t1en co&- and &aste7 If t1e UDF e:&ects to recei+e a &ara#eter t1en -ou need to &ass it to t1e functionC e7"7 N N'nAfter%a+eMU%IT*!AAd#AidB ot1er/ise lea+e it )lankC e7"7 NN'n3e/MU%IT*!AAd#AB7 "#$orting % &m$orting User Defined unctions. "#$orting UD Definitions from Cache e#$lorer T1e UDF definitions t1at are created under t1e Tool)o: are stored in t1e "lo)als /e)s-s7UserDefinedFunctionsI and /e)s-s7UserDefinedFunctionsD7 To e:&ort UDF definitions fro# a TrakCare s-ste# follo/ t1e )elo/ ste&s: 17 %tart t1e Cac1e *:&lorer /indo/ 27 Pia 0ames$ace on t1e left 1and sideC select t1e .*<%'U,C* na#es&ace under t1atC select <lobals7 T1e list of "lo)als in t1is na#es&ace s1ould dis&la- in t1e ri"1t>1and side &ane7 27 In t1e te:t )o: a)o+e t1e ri"1t>1and &aneC t-&e in t1e follo/in"C in t1e correct case: 67 1ebsys.UserDefinedunctions= T1en 1it F5 to refres1 t1e dis&la-7 57 T/o "lo)als s1ould no/ dis&la-: 67 %elect t1e #enu o&tion ile>"#$ort?Ctrl@" and click on %a+e to DiskQ 77 *nter filena#e and sa+e to disk TrakCare Tec1nical Docu#entation 7 of 25 TrakCare User Defined Functions "#$orting UD Routines from Cache "#$lorer T1e UDF Cac1e ,outines t1at are created are stored in t1e .*<%'U,C* na#es&ace7 To e:&ort UDF &ro"ra#s fro# TrakCare s-ste# follo/ t1e )elo/ ste&s: 17 In t1e te:t )o: a)o+e t1e ri"1t>1and &aneC t-&e in a ne/ selection criteria as follo/s: 27 UR7MAC 27 Pia 3a#es&ace on t1e left 1and sideC select t1e .*<%'U,C* na#es&aceC under t1atC select ,outines7 67 T1e ri"1t 1and side /ill no/ start to s1o/ all t1e R7MAC routines t1at )e"in /it1 EUF t1at e:ist in t1is na#es&ace7 57 T1e list of routines in t1is na#es&ace s1ould dis&la- in t1e ri"1t>1and side &ane7 It is i#&ortant t1at -ou +ie/ t1e status )ar of t1is /indo/ Aat t1e )otto#B7 T1is /ill sa- Fetc1in"Q /1ilst t1e list is still )ein" &o&ulated7 67 %elect t1e #enu o&tion *dit D %elect All to select all routines 77 %elect t1e #enu o&tion FileS*:&ortQCtrlT* and %a+e to Disk &m$orting UD Definitions from Cache "#$lorer To I#&ort User Defined Functions definitions into a TrakCare s-ste#: 17 %tart t1e Cache "#$lorer /indo/ 27 Pia 0ames$ace on t1e left 1and sideC select t1e .*<%'U,C* na#es&aceC under t1atC select <lobals. T1e list of "lo)als in t1is na#es&ace s1ould dis&la- in t1e ri"1t>1and side &ane7 27 In t1e te:t )o: a)o+e t1e ri"1t>1and &aneC t-&e in t1e follo/in"C in t1e correct case: 1ebsys.UserDefinedunctions= T1en 1it ! to refres1 t1e dis&la-7 T/o "lo)als s1ould no/ dis&la-: /e)s-s7UserDefinedFunctionsD and /e)s-s7UserDefinedFunctionsI 67 %elect t1e #enu o&tion "dit : Select -ll to select t1ese t/o "lo)als 57 %elect t1e #enu o&tion ile>Delete and confir# deletion of t1ese files 67 ,i"1t>#ouse click in t1e ri"1t>1and &ane and c1oose &m$ort from Dis3? TrakCare Tec1nical Docu#entation 8 of 25 TrakCare User Defined Functions 77 %&ecif- t1e location /1ere -ou &laced t1e e:&orted UDF 87 Click '&en and t1en I#&ort all7 Click Close /1en done7 &m$orting UD Routines from Cache "#$lorer 17 Pia 0ames$ace on t1e left 1and sideC select t1e .*<%'U,C* na#es&ace 27 'n t1e ri"1t 1and sideC ri"1t>#ouse click RoutinesC and select &m$ort from Dis3? 27 %&ecif- t1e location /1ere -ou &laced t1e e:&orted UDF routines 67 %elect t1e file na#e for t1is "rou& of routines 57 Click '&en and t1en I#&ort all7 Click Close /1en done7 "#$orting UD routine from Tra3Care 17 (o"on to TrakCare /e) A&&lication 27 4o to side #enu Toolbo#-:Aml "#$ort and )elo/ screen &o&s u&7 27 Make sure to select a suita)le site code and "o to File and c1oose Add UDF o&tion 67 After c1oosin" an UDF "o to ile Sa,e o&tion and t1en sa+e it to a file7 *:a#&le O4eckoOte#&Oteste:&ort7:#l &m$orting UD Routines from Tra3Care 2eb 17 (o"on to TrakCare /e) A&&lication 27 4o to side #enu Toolbo#-:Aml &m$ort and t1en "o to ile *$en and select t1e file /1ic1 /as sa+ed t1rou"1 HM( *:&ort refer a)o+e #entioned ste&s7 *:a#&le O4eckoOte#&Oteste:&ort7:#l 27 Make sure to c1oose a site code and &ress 'U7 TrakCare Tec1nical Docu#entation of 25 TrakCare User Defined Functions &m$lementing UDs Trak0ealt1 do not distri)ute UDFs7 T1e UDFs are #aintained )- t1e re#ote site/!artner7 As UDFs are Cac1e routines A(.AG% #ake de+elo&#ents in t1e MAC7 3e+er #ake de+elo&#ents in t1e 7I3T of t1e UDF )ecause if so#eone co#&iles t1e MAC t1en t1e c1an"es in t1e I3T /ill )e lost7 Add co##ents to t1e to& of t1e UDF detailin" t1e c1an"es #adeC lo" nu#)er $ -our initials7 T1is /ill 1el& tre#endousl- in &ro+idin" infor#ation on /1at UDFs are t1e correct +ersions7 ,e#e#)er to add co##ents t1rou"1out t1e code t1at -ou /rite to #ake it easier for ot1er &eo&le to #aintain t1e UDF in t1e future7 <- t1e nature of site s&ecific functionalit-C c1an"es /ill )e re@uired on an on"oin" )asis t1erefore it is i#&ortant to co##ent -our code7 As UDFs are o/ned )- t1e site it is +er- i#&ortant t1at t1e EDe+elo&#entF en+iron#ent is )acked u& on a re"ular )asis7 Use t1e HM( I#&ort/*:&ort utilit- in t1e (a-out *ditor to #o+e UDFs fro# en+iron#ent to en+iron#ent7 T1e structure of a UDF is +er- i#&ortant to 1o/ eas- it can )e #aintained7 Do not &ut all t1e code in t1e to& le+el of t1e Cac1e ,outine7 Create ot1er Cac1e routines /1ic1 1old t1e s&ecific e+ent lo"icC e7"7 t1e UDF routine U%IT*!AAd# calls anot1er routine called U%IT*!AAd#,e&orts /1ene+er a re&ort is re@uired to )e &rinted7 Also create a routine /1ic1 stores an- "eneric functions t1at -ou create7 UD Programming % Sam$les *nSB9Trigger Co1 to determine the Ty$e of an *nSB9Trigger ",entD Use t1e o)8ect ?o&er to deter#ine /1ic1 %;( e+ent tri""ered 'n%;(Tri""er e+ent7 UPAPerson ; User defined functions for class PAPerson ; ;called for every Insert/Update/Delete OnS!Tri""er#$ ;%oper &ill return eit'er I(SE)T* UPDATE or DE!ETE set ^+T,P#-PAPerson-*-Type-*$p#$'*-*-*.$$/%oper ; 0uit 1 TrakCare Tec1nical Docu#entation 10 of 25 TrakCare User Defined Functions Co1 to determine the &D of the record in an *nSB9Trigger ",entD Use t1e o)8ect ?dA1B to deter#ine t1e ID of t1e record in an 'n%;(Tri""er e+ent7 UPAPerson ; User defined functions for class PAPerson ; ;called for every Insert/Update/Delete OnS!Tri""er#$ ;returns t'e id of t'e current record set ^+T,P#-PAPerson-*-ID-*$p#$'*-*-*.$$/%d#1$ ; 0uit 1 *n+eforeSa,e Co1 to $o$u$ an "rror message in *n+eforeSa,eD To sto& t1e u&date and dis&la- a &o&u& #essa"e to t1e screenC @uit t1e 'n<efore%a+e e+ent /it1 a E0F7 T1e u&date of t1e record /ill onl- occur if -ou @uit /it1 E1F7 In ot1er /ordsC if -ou @uit /it1 J0J t1en t1e u&date /ill not occur7 T1e user /ill )e forced )ack to re>enter +alid data7 If -ou @uit /it1 J1J t1en t1e record /ill )e u&dated7 In t1e )elo/ e:a#&le an error #essa"e dis&la-s /1en t1e re"istration nu#)er is not 6 c1aracters in len"t1 and /1en itFs not nu#eric7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled 3efore savin" in &e3sysSave On4eforeSave#id$ ne& re"no*valid set valid/1 ; "et re"istration num3er from t'e pa"e set re"no/%re0uest56et#-)e"istration(um3er-$ set ^+T,P#$+n*-On4eforeSave-*-re"no-$/re"no if re"no7/-- 8 ;if re"istration num3er is not 9 di"its if $len"t'#re"no$7/9 set valid/: ;if re"istration num3er is not numeric if $translate#re"no*-1.;<=9>?@:-$7/-- set valid/: A ; add error messa"e ready for display if 7valid doBms" ms"5AddItem#-E-*-Invalid )e"istration (um3er-*re"no$ set ^+T,P#$+n*-On4eforeSave-*-valid-$/valid 0uit valid T1e error #essa"e /ill a&&ear si#ilar to )elo/: Clickin" V'UD /ill return -ou to t1e &re+ious *dit screen7 TrakCare Tec1nical Docu#entation 11 of 25 TrakCare User Defined Functions Co1 to $o$u$ a 2arning message in *n+eforeSa,eD %ee )elo/ for t1e )asic structure to use /1en a&&l-in" a .arnin" #essa"e to a UDF: On4eforeSave#id$ ; n compref*compid*override s compref/%re0uest56et#-TECE(T-$*compid/$e#$p#compref*-i-*1$*.*@@@$ s override/%re0uest56et#-TOCE))IDE-$ if override7/1 8 ; T'is line &ill set t'e re0uest o3Dect 7TOCE))IDE7 to 717 ; if user presses EOFG or --* if user presses E2A(2E!G Do ms"5AddItem#-H-*-Calue-*-Error messa"e - *compid*--$ A if override7/1 0 : ; ; 2ontinue &it' t'e rest of t'e On4eforeSave lo"ic5 ; 1 %ee )elo/ for an e:a#&le: UPAPerson ; User defined functions for class PAPerson ; ; 2alled 3efore savin" in &e3sysSave On4eforeSave#id$ ; s'o& &arnin" messa"e if eIistin" patient &it' same surname and firstname ; if ne& re"istration and if user clicJs OF if id/--*%re0uest56et#-TOCE))IDE-$7/1 8 ne& surname*firstname*first set #surname*firstname*first$/-- ; set surname/%re0uest56et#-PAPE)(ame-$ set firstname/%re0uest56et#-PAPE)(ame.-$ ; ; c'ecJ surname and first name set first/$o#^PAPE)i#-S6D-*KK2lass#%!i3rary52ollation$5Alp'aUp#surname$*KK2lass#%!i3rary52ollation$5Alp'aUp#f irstname$L- -*:$$ ; ; if name already eIists display &arnin" messa"e if first7/-- do ms"5AddItem#-H-*surnameL-* -Lfirstname*-An eIistin" patient already 'as t'is name* continueM-*compid*--$ A ; 0uit 1 T1e /arnin" #essa"e /ill a&&ear si#ilar to )elo/: Click V'UD to continue or click VCancelD to return to t1e &re+ious screen7 TrakCare Tec1nical Docu#entation 12 of 25 TrakCare User Defined Functions msg.-dd&tem *b.ect T1e W"lo)alX +aria)le #s" is created in /e)s-s7cs& as a ne/ instance of /e)s-s7Messa"e A/e)s-s7cs& is t1e in>)et/een ser+er &a"e to deter#ine /1ere to "oB7 .1en t1e #s"7AddIte#A777B is e:ecuted in an UDFC t1e screen reloads )ackC t1e #essa"e dis&la-s and de&endin" on t1e t-&e of t1e #essa"eC t1e screen sta-s or continues in t1e /orkflo/7 ClassMethod D ms"5AddItem#type*code*description*compid*fieldname*isdirty*Dsfunction$ Parameters t-&e *Y*rrorC .Y.arnin"C IYInfor#ationC 3Y3otificationC ZYZa+a%cri&t code Messa"e codeC t1e code is usuall- t1e field t1at caused t1e error descri&tion Messa"e descri&tionC t1e descri&tion is usuall- t1e actual #essa"e co#&id co#&id is t1e id of t1e co#&onent t1at t1e error occurred onC t1is is re@uired so /e can dis&la- t1e ri"1t error #essa"e on t1e correct screen7 fieldna#e Fieldna#e is t1e na#e of t1e field /1ere t1e error occurred on7 T1is is not re@uiredC )ut if entered t1e screen /ill dis&la- t1e field /it1 t1e clsIn+alid st-le Ared )order around t1e field to s1o/ errorB isdirt- Vnot usedD 8sfunction a 8a+ascri&t function na#e Types * !a"e reloadsC #essa"e a&&ears /it1 'U )utton onl-C user clicks 'UC &a"e re#ains . &a"e reloadsC #essa"e a&&ears /it1 'U / Cancel )uttonC if user clicks Cancel &a"e re#ains7 if user clicks 'UC T'P*,,ID* set to 1C &a"e "ets resu)#itted and class#et1od is run a"ainC &a"e #o+es on to ne:t screen I &a"e reloadsC #essa"e a&&ears /it1 'U )utton onl-C user clicks 'UC T'P*,,ID* set to 1C &a"e "ets resu)#itted and class#et1od is run a"ainC &a"e #o+es on to ne:t screen 3 &a"e #o+es on to ne:t screenC #essa"e a&&ears /it1 'U )utton onl- Z &a"e reloadsC #essa"e a&&ears /it1 'U / Cancel )uttonC if user clicks Cancel &a"e re#ains7 if user clicks 'UC T'P*,,ID* set to 1 t1en 8sfunction is called I t1is 8sfunction 1andles /1ere to &roceed fro# t1ere I sta- or #o+e on7 For t-&es .C IC Z )ecause t1e class#et1od "ets run a"ainC t1e T'P*,,ID* is usuall- c1ecked a"ain so t1e #essa"e does not a&&ear a"ain Aand send it to an infinite loo&B7 TrakCare Tec1nical Docu#entation 12 of 25 TrakCare User Defined Functions *n0e1 Co1 to default fields in the *n0e1 e,entD Alt1ou"1 it is &ossi)le to default fields in an 'n3e/ e+ent it is reco##ended to use t1e (a-out *ditor functionalit- to default fields7 T1e )elo/ e:a#&le de#onstrates 1o/ t1e !referred (an"ua"e and Countr- of <irt1 can )e defaulted in t1e 'n3e/ e+ent7 3'T*: t1e ob. +aria)le at t1is ti#e is used as t1e structured +aria)le fro# /1ic1 t1e /e) &a"e is dra/n7 Conse@uentl-C if 8ust )efore t1e &a"e is dra/n Aas in t1e 'n3e/ e+entBC -ou &re>&o&ulate &ro&erties in t1e o)8 classC and t1ese +alues /ill )e inserted onto t1e &a"e te:t )o:es7 Eo)8F is an instance of t1e classna#e s&ecified in t1e UDF7 Use t1e <et&dromCode*rDescri$tion and Set*b.ect&d #et1ods to &o&ulate ,o/ID +alues into t1e ob. &ro&erties7 In t1is e:a#&leC /e are &o&ulatin" default +alues for Countr- of <irt1C and !referred (an"ua"e fields7 UPAPerson ; User defined functions for class PAPerson ; On(e&#$ ne& countryid*lan"id ; set ^+T,P#-PAPerson-*-On(e&-*1$/-Start- ;default 2ountry of 4irt' usin" code -AU- set countryid/KK2lass#&e352T2ountry$56etIdNrom2odeOrDescription#-UF-$ if countryid do o3D5PAPE)2ountry4irt'D)5SetO3DectId#countryid$ ; ;default Preferred lan"ua"e usin" code -E(6- set lan"id/KK2lass#&e35PA2Preferred!an"ua"e$56etIdNrom2odeOrDescription#-E(6-$ if lan"id7/-- d o3D5PAPE)Pref!an"ua"eD)5SetO3DectId#lan"id$ ; set ^+T,P#-PAPerson-*-On(e&-*@$/-End- 0uit 1 TrakCare Tec1nical Docu#entation 16 of 25 TrakCare User Defined Functions &dentifying Com$onents % 2or3flo1s .1en de+elo&in" UDFs it is so#eti#es necessar- to identif- t1e e:act &oint of a /orkflo/ /1ere s&ecific functionalit- is re@uired7 For e:a#&leC if a re&ort s1ould onl- )e &rinted in t1e !A!erson7*dit co#&onent in t1e Trak7*#er"enc- 0eader *&isode /orkflo/7 Co1 to identify a s$ecific com$onentD To identif- a s&ecific co#&onentC e7"7 t1e E!A!erson7*ditF co#&onentC use t1e TF',M +aria)le in t1e ?re@uest o)8ect7 T1is +aria)le stores t1e na#e of t1e co#&onent7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& component ; set component/%re0uest56et#-TNO),-$ if component/-PAPerson5Edit- 8 ;place component specific lo"ic 'ere A 0uit 1 Co1 to identify a s$ecific 1or3flo1D To identif- a s&ecific /orkflo/C e7"7 t1e ETrak7*#er"enc- 0eader *&isodeF /orkflo/C use t1e T.UF( +aria)le in t1e ?re@uest o)8ect7 T1is +aria)le stores t1e id of t1e /orkflo/7 It is t1erefore necessar- to o)tain t1e id fro# t1e descri&tion usin" t1e E<et&dromCode*fDescri$tionF #et1od7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& &Jfl ; set &Jfl/KKclass#&e3sys5HorJNlo&$56etIdNrom2odeOrDescription#-TraJ5Emer"ency Oeader Episode-$ if &Jfl/%re0uest56et#-THFN!-$ 8 ;place &orJflo& specific lo"ic 'ere A 0 1 Co1 to identify a s$ecific 1or3flo1 itemD To identif- a s&ecific /orkflo/ ite#C e7"7 t1e !A!erson7*dit in t1e ETrak7*#er"enc- 0eader *&isodeF /orkflo/C use t1e T.UF(I +aria)le in t1e ?re@uest o)8ect7 T1is +aria)le stores t1e id of t1e /orkflo/ ite#7 To identif- t1e id of t1e /orkflo/ ite# see t1e /orkflo/ and if t1e re@uire /orkflo/ ite# is 2 rd in t1e list t1en t1e ite# id /ill )e 27 %ee )elo/ for furt1er details: UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& &Jfl ; set &Jfl/KKclass#&e3sys5HorJNlo&$56etIdNrom2odeOrDescription#-TraJ5Emer"ency Oeader Episode-$ ; identify ;rd item in &orJflo&5 if &Jfl/%re0uest56et#-THFN!-$*%re0uest56et#-THFN!I-$/; 8 ;place &orJflo& item specific lo"ic 'ere A 0uit 1 TrakCare Tec1nical Docu#entation 15 of 25 TrakCare User Defined Functions Co1 to find out 1or3flo1 idsD ,i"1t #ouse click on t1e re@uired /orkflo/ and click EPie/ %ourceF7 Using Class *b.ects Co1 to in,estigate and u$date a record using class ob.ectsD To retrie+e a record usin" class o)8ects use t1e ?'&enId #et1od /it1 t1e User &acka"e of t1e TrakCare class7 All &ro&erties of a class can )e referenced after it is Eo&enedF7 Class and &ro&ert- na#es are t1e sa#e as t1e %;( ta)le and field na#es )ut /it1out t1e underscore c1aracters7 ,e#e#)er to al/a-s c1eck if t1e o)8ect e:ists )efore use7 Al/a-s close t1e o)8ect after use /it1 t1e ?Close #et1od UPAAdm ; User defined functions for class PAAdm ; ; 2alled after savin" in &e3sysSave TrakCare Tec1nical Docu#entation 16 of 25 TrakCare User Defined Functions OnAfterSave#id$ ne& o3D if $"et#id$7/-- 8 set o3D/KK2lass#User5PAAdm$5%OpenId#id$ if o3D 8 set ^+T,P#-PAAdmOnAfterSave-*-)e0uest,)-$/o3D5PAAD,)e0uest,) if o3D5PAAD,)e0uest,)/-P- 8 ;perform site specific lo"ic A do o3D5%2lose#$ A A ; 0uit 1 Co1 to read and u$date a multi-line field using class ob.ectsD Multi>line fields re@uire e:tra code to read and to u&date7 %ee )elo/ e:a#&le: ;T'e 3elo& script "ets t'e multi line field and 3uilds a concatenated strin"5 ; ne& remarJs*D*o3D set o3D/KKclass#User5OEOrdItem$5%OpenId#itemid$ for D/1B1Bo3D5OEO)I)emarJs52ount#$ 8 set remarJs/remarJsLo3D5OEO)I)emarJs56etAt#D$L$c#1;*1:$ A ; ;t'e 3elo& &'ic' updates a multiQline field and inserts into data3ase ; ne& o3D set o3D/KKclass#User5OEOrdItem$5%OpenId#itemid$ ; do o3D5OEO)I)emarJs52lear#$ do o3D5OEO)I)emarJs5Insert#-)emarJs One-$ do o3D5OEO)I)emarJs5Insert#-)emarJs T&o-$ do o3D5OEO)I)emarJs5Insert#-)emarJs T'ree-$ do o3D5OEO)I)emarJs5Insert#-)emarJs Nour-$ ; do o3D5%Save#$ do o3D5%2lose#$ TrakCare Tec1nical Docu#entation 17 of 25 TrakCare User Defined Functions Co1 to use Designati,e Reference $ro$erties using class ob.ectsD A Desi"nati+e ,eference AD,B is a &ointer to anot1er ta)le7 D,s can also )e referred to as forei"n ke-s7 T1e ?IdAB #et1od returns t1e actual D, +alueC i7e7 t1e ro/id +alue of t1e ot1er ta)le /1ere t1e &ro&ert- na#e /ill return t1e id of t1e o)8ect itself7 D, &ro&erties can )e used as &ointers so t1e- can )e linked until t1e re@uired +alue is found7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& o3D*+ipid*+ipo3D*cityid*cityo3D*countryo3D*countrydesc Jill ^+T,P ; if $"et#id$7/-- 8 set o3D/KK2lass#User5PAPerson$5%OpenId#id$ set ^+T,P#-PAPerson-*-OnAfterSave-*-id-$/id ;if t'e patient 'as a postcode if o3D5PAPE)RipD)7/-- 8 ;"et +ip o3Dect set +ipo3D/o3D5PAPE)RipD) set ^+T,P#-PAPerson-*-OnAfterSave-*-RipO3Dect-$/+ipo3D ; ;"et +ip id set +ipid/o3D5PAPE)RipD)5%Id#$ set ^+T,P#-PAPerson-*-OnAfterSave-*-RipID-$/+ipid ; ;linJ t'rou"' +ip o3Dect to "et city o3Dect set cityo3D/o3D5PAPE)RipD)52TRIP2ITPD) set ^+T,P#-PAPerson-*-OnAfterSave-*-2ityO3Dect-$/cityo3D ;linJ t'rou"' +ip o3Dect to "et city id set cityid/o3D5PAPE)RipD)52TRIP2ITPD)5%Id#$ set ^+T,P#-PAPerson-*-OnAfterSave-*-2ityID-$/cityid ; ;assumin" t'at all t'e code ta3les are set* linJ from city o3Dect to "et country description ;if any of t'e o3Dects are null t'en an error &ill occur555 set countryo3D/cityo3D52T2ITProvinceD)5P)OC)e"ionD)52T)62ountryD) set countrydesc/countryo3D52T2OUDesc set ^+T,P#-PAPerson-*-OnAfterSave-*-2ountryDesc-$/countrydesc A A ; 0uit 1 TrakCare Tec1nical Docu#entation 18 of 25 TrakCare User Defined Functions 5session % 5request *b.ects Co1 to use the 5session ob.ectD 5CSP.Session o)8ect contains infor#ation a)out t1e current session7 For e:a#&leC in TrakCareC t1is o)8ect contains infor#ation a)out t1e (o"in User and t1e %ite7 Gou can refer to t1is o)8ect usin" t1e o)8ect %session. T1e ?session o)8ect al/a-s includes t1e follo/in" +alues: Descri$tion Re$ort Parameter (o"in (ocation ID %session.Get("LOGON.CTLOCID") %ite Code %session.Get(LOGON.SITECODE) (o"in User ID %session.Get("LOGON.USERID") (o"in User Code %session.Get(LOGON.USERCODE) (o"in User 3a#e %session.Get(LOGON.USERNAME) (o"in 4rou& ID %session.Get(LOGON.GROUPID) (o"in 4rou& 3a#e %session.Get(LOGON.GROUPDESC) (o"in (an"ua"e ID %session.Get(LOGON.LANGID) Client !C I! Address %session.Get("REMOTE_ADDR") Co1 to use the 5request ob.ectD 5CSP.Request o)8ect contains infor#ation a)out t1e current &a"e7 .1en t1e C%! %er+er res&onds to an 0TT! re@uestC it &acka"es u& infor#ation a)out t1e inco#in" re@uest in an instance of t1e ?C%!7,e@uest o)8ect7 For e:a#&leC if a &atient is selectedC t1is o)8ect contains infor#ation like t1e !atient ID and t1e *&isode ID7 Gou can refer to t1is o)8ect usin" t1e +aria)le %request7 To c1eck /1at +alues -ou 1a+e a+aila)le -ou can ri"1t #ouse click an-/1ere on a &a"e and EPie/ %ourceF7 For e:a#&leC if -ou c1eck t1e Pie/ %ource for a !atient ,e"istration screen and scroll do/n to t1e 1idden +alue sectionC -ou /ill see t1e +aria)les t1at are a+aila)le and t1eir +alues7 Report Parameter Examples Eariable Descri$tion Re$ort Parameter !atientID !atient ,o/Id %request.Get(PatientID) *&isodeID Ad#ission ,o/Id %request.Get(EpisodeID) TrakCare Tec1nical Docu#entation 1 of 25 TrakCare User Defined Functions Printing7 Re$orting and "mailing Co1 to $rint a re$ortD Use t1e [[ClassA/e)s-s7,e&ortB7!rint #et1od to &rint a re&ort7 T1e #andator- &ara#eters are: ,*!',TC'D* ('4I3('CATI'3 I!ADD,*%% Use t1e ?session o)8ect to retrie+e t1e lo"in location and t1e i& address7 Print Method Parameters Parameters Descri$tion ,e&ortCode Uni@ue code for t1e re&ort -ou /ant to &rint (ocationID Used in !rint Mana"er to deter#ine t1e destination &rinterC e7"7 lo"in location I! Used in !rint Mana"er to deter#ine t1e destination &rinterC e7"7 client i& address Filena#e 3a#e of file /1en re&ort is e:&orted7 A&&lies to cr-stal re&orts and /ord docu#ents UserID (o"in userid MailFro# *#ail address fro# for e#ailin" re&orts as attac1#ents MailTo Destination e#ail address for e#ailin" re&orts as attac1#ents MailCC CC e#ail address for e#ailin" re&orts as attac1#ent Mail%u)8ect *#ail su)8ect for e#ailin" re&orts as attac1#ents MailMessa"e *#ail #essa"e for e#ailin" re&orts as attac1#ents De+ice !rinter de+ice for o+erridin" de+ice returned fro# !rint Mana"er 3o'fCo&ies 3u#)er of co&ies to &rint Class3a#e Inserted in ,e&ort 0istor-C re&resents t1e ta)le t1at t1e re&ort is &rinted a"ainst Class3a#eID Inserted in ,e&ort 0istor-C re&resent t1e ro/id of t1e ta)le of t1e re&ort &rinted ,e&ort0istor-ID ,e@uested ,e&ort 0istor- IDC used for re&rintin" re&orts fro# ,e&ort 0istor- ContactMet1odT-&e %tandard T-&e used to indicate t1e t-&e of contact #et1odC i7e7 !rintC *#ailC Fa: Contact,eci&ient Used to indicate t1e ,eferral Doctor reci&ient fro# !AC\,efdoctor ,e&rint T1is is set /1en re&ort is ticked for re&rint %a+eonl- UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ; if $"et#id$7/-- 8 ;Print Patient !a3els do KK2lass#&e3sys5)eport$5Print#-PAT!A4E!S-*%session56et#-!O6O(52T!O2ID-$*%session56et#-)E,OTELADD)-$$ A ; 0uit 1 TrakCare Tec1nical Docu#entation 20 of 25 TrakCare User Defined Functions Co1 to setu$ $arameters for a re$ortD To setu& &ara#eters for a re&ort in a UDF set a +aria)le in t1e ?re@uest o)8ect7 Use t1e ?re@uest7%et functionC e7"7 d ?re@uest7%etAW&ara#1XCX+alueXB t1en in t1e ,e&ort Mana"er use t1e ?re@uest74etAW&ara#1XB e:&ression to e:tract t1e +alue7 !lease )e careful not to o+er/rite an- e:istin" +aria)les in t1e ?re@uest o)8ect7 C1eck t1e Pie/ %ource of t1e &a"e to c1eck for e:istin" +aria)les7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ; if $"et#id$7/-- 8 ;Setup parameters Set value/StestS Do %re0uest5Set#Tparam1S*value$ do KK2lass#&e3sys5)eport$5Print#-PAT!A4E!S-*%session56et#-!O6O(52T!O2ID-$* %session56et#-)E,OTELADD)-$$ A ; 0uit 1 Co1 to chec3 if a s$ecific re$ort has been $rinted beforeD To c1eck if a re&ort 1as )een &rinted )efore /it1 t1e sa#e &ara#eters use t1e )elo/ #et1od: Do KK2lass#&e3sys5PrintOistory$5OasPrinted#)eport2ode*P1*P.*P;*P<*P=*P9*P>*P?*P@$ 3ote: !1 to ! are o&tional7 UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& &Jfl*patid ; set patid/%re0uest56et#-PatientID-$ set &Jfl/KKclass#&e3sys5HorJNlo&$56etIdNrom2odeOrDescription#-TraJ5Emer"ency Oeader Episode-$ ; ; if in t'e ;rd HorJflo& Item of t'e TraJ Emer"ency HorJflo& if &Jfl/%re0uest56et#-THFN!-$*%re0uest56et#-THFN!I-$/; 8 ; if Patient !a3els 'as not 3een printed 3efore &it' PatientID 3ein" t'e first and only report parameter if 7#KK2lass#&e3sys5PrintOistory$5OasPrinted#-PATIE(TL!A4E!S-*patid$$ 8 ; print Patient !a3els report do KK2lass#&e3sys5)eport$5Print#-PATIE(TL!A4E!S-*%session56et#-!O6O(52T!O2ID-$* %session56et#-)E,OTELADD)-$$ A A 0uit 1 TrakCare Tec1nical Docu#entation 21 of 25 TrakCare User Defined Functions Co1 to $rint a re$ort if a Print chec3bo# is chec3edD To &rint a re&ort if a &rint c1eck)o: is tickedC c1eck t1e +alue of t1e 1idden field is FonF7 *:a#&le: UPAPerson ; User defined functions for class PAPerson ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& &Jfl*patid ; set patid/%re0uest56et#-PatientID-$ set &Jfl/KKclass#&e3sys5HorJNlo&$56etIdNrom2odeOrDescription#-TraJ5Emer"ency Oeader Episode-$ ; ; HorJflo& is t'e TraJ Emer"ency HorJflo& if &Jfl/%re0uest56et#-THFN!-$ 8 ; if Print Patient !etter c'ecJ3oI is ticJed i %re0uest56et#-PrintPatient!etter-$/-on- 8 ; print Patient !a3els report do KK2lass#&e3sys5)eport$5Print#-PATIE(TL!ETTE)-*%session56et#-!O6O(52T!O2ID-$* %session56et#-)E,OTELADD)-$$ A A 0uit 1 Co1 to sa,e a Crystal Re$ort as a fileD Use t1is #et1od and &ara#eters to sa+e re&ort to file: Do KK2lass#&e3sys5)eport$5Print#)eport2ode* TS* TS* NullNilePat'(ame$ *:a#&le: U)4Appointment ;User defined function for class )4Appointment ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ ne& Nilename*NilePat'*)eport2ode ; set NilePat'/-cBUtemp- set )eport2ode/-APPT!ETTE)- ; set Nilename/NilePat'L)eport2odeL$Do3L-5rtf- set Nilename/NilePat'L$Do3L-5rtf- ; ;save crystal report appoinment letter to cBUtemp as rtf file do KKclass#&e3sys5)eport$5Print#)eport2ode*--*--*Nilename$ ; 0uit 1 TrakCare Tec1nical Docu#entation 22 of 25 TrakCare User Defined Functions Co1 to email a messageD To e>#ail fro# TrakCareC #ake sure t1at s#t& ser+er na#e is set u& in Confi"uration Mana"er7 Use t1is #et1od and &ara#eters to e#ail a #essa"e: Do KK2lass#&e3sys5,ail$5Vo3Item#Nrom*To*22*Su3Dect*,essa"e*SS$ 'r testemail#loop$ ;s #filename*ip$/-- s locationid/$o#^2T!O2#:$$ s ip/$p#$p#$RU#1;1*1$*-B-*.$*-*-*1$ ;s ip/-- s userid/$o#^SSU#-SSUS)-*:$$ s filename/-test&ord5rtf- s #,ailNrom*,ailTo$/-Nirst(ame5!ast(ameWtraJ'ealt'5com- i $"#loop$7/-- d 5f I/1B1Bloop d 55d KK2lass#&e3sys5)eport$5Print#-TEST)EPO)T-*locationid*ip*filename*userid*,ailNrom* ,ailNrom*--*-T'is is a test for TPS I5II-*-messa"e 3ody-*--*--$ i $"#loop$/-- d KK2lass#&e3sys5)eport$5Print#-TEST)EPO)T-*locationid*ip*filename*userid*,ailNrom*,ailTo*--* -T'is is a test of email for TPS I5II-*-messa"e 3ody-*--*--$ Oo& to email a messa"e &it' an attac'ementM Use t'is met'od and parameters to email a messa"e &it' an attac'mentB Do KK2lass#&e3sys5,ail$5Vo3Item#Nrom*To*22*Su3Dect*,essa"e*Attac'ment$ *:a#&le: U)4Appointment ;User defined function for class )4Appointment ; ; 2alled after savin" in &e3sysSave OnAfterSave#id$ (e& Nrom*To*Su3Dect*22*,essa"e*crlf*Attac'ment ; ; set up email details set Nrom/-TraJ2areWTraJ'ealt'5com- set To/-DoctorWTraJ'ealt'5com- set Su3Dect/-Doctor (otification- set 22/-)e"istrationWTraJ'ealt'5com- ; ; &rite email messa"e set crlf/$c#1:$L$c#1;$ set ,essa"e/-Attention-Lcrlf set ,essa"e/,essa"eL-T'is is t'e 3ody-Lcrlf set ,essa"e/,essa"eL-of t'e email messa"e5-Lcrlf set ,essa"e/,essa"eLcrlf set ,essa"e/,essa"eL-)e"ards*-Lcrlf set ,essa"e/,essa"eLcrlf set ,essa"e/,essa"eL-TraJ'ealt'5-Lcrlf ; ; send email messa"e &it'out attac'ment do KKclass#&e3sys5,ail$5Vo3Item#Nrom*To*22*Su3Dect*,essa"e*--$ ; ; send email &it' attac'ment X include pat' and filename set Attac'ment/-cBUtempUdata5tIt- do KKclass#&e3sys5,ail$5Vo3Item#Nrom*To*22*Su3Dect*,essa"e*Attac'ment$ ; 0uit 1 TrakCare Tec1nical Docu#entation 22 of 25 TrakCare User Defined Functions Co1 to PrintF"mail a 2ord Tem$lateD T1is )elo/ code is used to /e#ail sa+ed disc1ar"e su##ar- .ord te#&lates testemail&ord#loop$ s locationid/$o#^2T!O2#:$$ s ip/$p#$p#$RU#1;1*1$*-B-*.$*-*-*1$ s filename/$li#^&e3sys52onfi"urationD#1$*;;$L-Utest&ord5dot- s userid/$o#^SSU#-SSUS)-*:$$ i $"#loop$7/-- d 5f I/1B1Bloop d 55d KK2lass#&e3sys5)eport$5Print#-Test)eport-*locationid*ip*filename*userid*,ailNrom*,ailTo*,ail22*,ail ,ailSu3Dect*,ail,essa"e*Device*noofcopies*2lass(ame*2lass(ameID*)eportOistoryID*met'*recip$ i $"#loop$/-- d KK2lass#&e3sys5)eport$5Print#-Test)eport-*locationid*ip*filename*userid*,ailNrom*,ailTo*,ail22* ,ailSu3Dect*,ail,essa"e*Device*noofcopies*2lass(ame*2lass(ameID*)eportOistoryID*met'*recip$ 0 testemailpdf#loop$ s locationid/$o#^2T!O2#:$$ s ip/$p#$p#$RU#1;1*1$*-B-*.$*-*-*1$ s filename/$li#^&e3sys52onfi"urationD#1$*;;$L-U-L$DL-5pdf- s userid/$o#^SSU#-SSUS)-*:$$ s #,ailNrom*,ailTo$/-Nirst(ame5!ast(ameWtraJ'ealt'5com- i $"#loop$7/-- d 5f I/1B1Bloop d 55d KK2lass#&e3sys5)eport$5Print#-TEST)EPO)T-*locationid*ip*filename*userid*,ailNrom*,ailTo*--* -T'is is a test of email for TPS <5..-*-messa"e 3ody-*--*--$ i $"#loop$/-- d KK2lass#&e3sys5)eport$5Print#-TEST)EPO)T-*locationid*ip*filename*userid*,ailNrom*,ailTo*--* -T'is is a test of email for TPS <5..-*-messa"e 3ody-*--*--$ 0 Methods %ee )elo/ for useful #et1ods t1at are )uilt inside t1e TrakCare a&&lication7 T1is #et1ods can )e e:ecuted in a Cac1e Ter#inal session7 Co1 to determine the Com$uter 0ame from &P -ddressD T1is #et1od returns t1e co#&uter na#e of an I! address usin" re+erse looku&: & KK2lass#&e3sys52onversions$56et2omputer(ame#ip$ Co1 to determine 1hat the Destination Printer 1ill be from Print ManagerD T1is #et1od @ueries t1e !rint Mana"er and returns t1e &rinter de+ice Afro# t1e !rinter %etu&B t1at /ill )e inserted in t1e !rint 0istor- for t1e &rint 8o) & KK2lass#&e3sys5Print$56etPrinter#)eport2ode*!ocationId*ip$ TrakCare Tec1nical Docu#entation 26 of 25 TrakCare User Defined Functions 9anguage Reference (ists all t1e #et1ods/functions t1at /ere used in t1e a)o+e e:a#&les7 <et&dromCode*rDescri$tion T1is #et1od returns t1e ,o/Id fro# eit1er t1e Code or t1e Descri&tion7 It is an in1erited class #et1od t1at e:ists in all classes in t1e /e) &acka"e7 Set*b.ect&d T1is #et1od sets t1e +alue for all Desi"nati+e ,eference &ro&erties7 It is an in1erited class #et1od t1at can )e used for all &ro&erties in t1e User &acka"e t1at references anot1er class7 T1at isC all fields t1at &oint to ot1er ta)les7 TrakCare Tec1nical Docu#entation 25 of 25