Hello,
I am trying to write a comprehensive CPS12 immunization form in VFE that populates the immunization with both the appropriate OBSTERMS and also pushes the immunization to the SQL Immunization Database using the IMMUN_ADD MEL Function.
I am receiving the following error code -9 (A data field could not be converted to a date/time) with my DOCUMENT.NAAC_FLU_VAC_DATE_ELSEWHERE.
Is there another way to format this Date variable into the IMMUN_ADD function so as not to receive the error code. I would appreciate any help from fellow CHUG programers. I have included a snippet of the effected code in my form.
Thank you in advance for any assistance
Jaisan
****************************************************************************
Problem code area
** form Button RUNPROCESS **
NAAC_IMM_ADD_TO_DATABASE("FLU VAX","Influenza - Unspecified Formulation [CVX88]","","N","Y","04 - Historical information - from parent's recall","","","","","","","","", DOCUMENT.NAAC_FLU_VAC_DATE_ELSEWHERE,"M","CVX88")
******* VFE White Space code Snippets ****************
/* function variables
aa - Vac Group (pos 1 required)
bb - Vacname (pos2 required)
cc - series (pos 4 optional)
dd - WasGiven (pos 5 (Y or N) required)
ee - historical (pos 7 (Y or N) required)
ff - historical source (pos 8 optional)
(pos 9 - V00 - VFCEligibilty not determined required by practice)
gg - administered dose (pos 16 optional)
hh - admin dose units (pos 17 optional)
ii - route (pos 18 optional)
jj - site (pos 20 optional)
kk - Manufacturer (pso 22 optional)
ll - Lot number (pos 24 optional)
mm - Expiratation date (pos 25 optional)
nn - Administered by (pos 27 optional)
oo - Admindate (pos 28 required)
pp - admindate type ( pos 29 (D, M OR Y) optional)
qq - CVXCode (pos 15 optional)
Usage in function
Historical = NAAC_IMM_ADD_TO_DATABASE(aa,bb,cc,dd,ee,ff,"","","","","","","","",oo,pp,qq)
administered = NAAC_IMM_ADD_TO_DATABASE(aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq)
**** */
{fn NAAC_IMM_ADD_TO_DATABASE(aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq)
{
if str(aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq)="" then userok("No values entered") else
NAAC_IMM_ADD_Error( IMMUN_ADD("str(aa)^str(bb)^^str(cc)^str(dd)
^^str(ee)^str(ff)^V00^^^^^^ str(qq)^str(gg)^str(hh)^str(ii)^^str(jj)^^str(kk)^^str(ll)
^str(mm)^^str(nn)^str(oo)^str(pp)^^^^^^^^^")) endif
return ""
}}
{fn NAAC_IMM_ADD_Error(add){
if (add ="" or add="None") then
userok("Successfully added Historical Immunization to SQL database")
return ""
endif
cond
case (add == "-1") userok("Empty or missing immunization definition")
case (add == "-2") userok("VaccineGroupName not specified")
case (add == "-3") userok("WasGiven not specified")
case (add == "-5") userok("Historial not specified")
case (add == "-6") userok("VFCEligibility not specified")
case (add == "-7") userok("Database error occurred (this is often a field length issue")
case (add == "-8") userok("A numeric field could not be converted to a number")
case (add == "-9") userok("A data field could not be converted to a date/time")
case (add == "-10") userok("AdministerDate not specified")
case (add == "-17") userok("Null pointer could not be obtained")
case (add == "-18") userok("Clinical list lock could not be obtained")
case (add == "-19") userok("CVXCode not specified")
case (add == "-99") userok("An unknown error occurred")
else
userok("Unknown Error")
endcond
}}
I'm not sure if I'm following everything you are doing in your code, but it seems like it should work fine to me... at least you shouldn't get that error. What I might try just to see what response you get it to convert your string to a value first before trying to submit it to the table:
tempvar = val(DOCUMENT.NAAC_FLU_VAC_DATE_ELSEWHERE)
Then pass the converted value to IMMUN_ADD().
Just a thought. I'm not familiar with IMMUN_ADD() so I might be off the mark.
Brad
Here is an example of a working quicktext with more hard-coded data. I'm still developing something more automated. It did successfuly produce an immunization record. Take a look at your date format and see if it matches.
{IMMUN_ADD('tDap^BOOSTRIX 5-2.5-18.5 SUSP^BOOSTRIX 5-2.5-18.5 SUSP^1^Y^^N^^V01^94372^^^^58160084211^20^0.5^mL^IM^C28161^Left Arm^LA^GlaxoSmithKline^SKB^561^12/31/2017^1/1/1999^username^10/15/2014^D^well tolerated^10/16/2014^D^dizziness^providername^^^^^')}
This is a working quicktext that puts today's date and a 10-month future date into MEL_ADD_MEDICATION.
{MEL_ADD_ORDER("S","Injections","Flu Vaccine","","ICD-V04.81","FLU VACCINE")}{MEL_ADD_MEDICATION("FLUARIX QUADRIVALENT","Given "+str(._TODAYSDATE),str(._TODAYSDATE),"58160090152",ADDDATES(str(._TODAYSDATE),"0","10","0"),"0","0","","","ICD-V04.81","FLU VACCINE")UPDATE_MEDS()}
Julie Sander [email protected]