I'm trying to get my action button to work on one of my vfe forms. When end user clicks on action button I want it to calculate weight change from birth.
This is what I tried. Please help!
Connection : Calculation
Target: WEIGHT CALC
OBSANY("BIRTH WT KG" - OBSNOW ("WEIGHT (KG)"))
Thanks,
Tonya M. Racine
EMR Training and Support Specialist
Woodcreek Healthcare
(253) 446-3622 work (253) 680-9696 cell
Try this in the button:
OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)")) – val(OBSANY(BIRTH WT KG")))
userok(OBSNOW("WEIGHT GAIN"))
I tried and got this mel.
{
/*FUNCTION DEFINITIONS*/
/*Function for Calculation Button Calculate weight change from birth:*/
fn fn4942_1331569980_455(){
OBSNOW("WEIGHT GAIN", (str(OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)")) – val(OBSANY(BIRTH WT KG")))
userok(OBSNOW("WEIGHT GAIN"))
)))
}
}{/*START OF FORM TRANSLATION BODY*/
}{"
" + FMT("Breastfeeding Assessment ", "B,2") + "
" + "
" + FMT("Birth Weight Standard Metric ", "B,2") + "
" + CFMT(F4942_1333407967_71, "", "Birth weight: ", "", "
") + "lb
" + CFMT(F4942_1333407967_72, "", " ", "", "
") + "kg
" + "
" + FMT("Last Weight Standard Metric ", "B,2") + "
" + CFMT(F4942_1333407967_73, "", " ", "B", "
") + "lb
" + CFMT(F4942_1333407967_74, "", " ", "B", "
") + "kg
" + CFMT(DOCUMENT.DATE_OF_LAST_4942_1331254790_320, "", "Date of last weight: ", "B", "
") + "
" + FMT("Current Weight Standard Metric ", "B,2") + "
" + CFMT(F4942_1333407967_75, "", "Current Weight: ", "B", "
") + "lb
" + CFMT(F4942_1333407967_76, "", " ", "B", "
") + "kg
" + CFMT(F4942_1333407967_78, "", " ", "B", "
") + "kg
"}
It might be the missing quotation mark in the OBSANY symbol:
OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)")) – val(OBSANY("BIRTH WT KG")))
userok(OBSNOW("WEIGHT GAIN"))
Did not see that. Ok tried and this is what I got back.
/*FUNCTION DEFINITIONS*/
/*Function for Calculation Button Calculate weight change from birth:*/
fn fn4942_1331569980_455(){
OBSNOW("WEIGHT GAIN", (str(OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)"))) - val(OBSANY("BIRTH WT KG")))
userok <-COMPILER ERROR NEARBY: Expect COMMA OR RIGHT PARENTHESIS. Instead had FUNCTION after RIGHT PAREN
Please let me know. Thanks for all your help.
Tonya
For some reason you have imbedded the OBSNOW("WEIGHT GAIN") inside of itself.
OBSNOW("WEIGHT GAIN", (str(OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)"))) – val(OBSANY("BIRTH WT KG")))
Should actually be:
OBSNOW("WEIGHT GAIN", str(val(OBSNOW("WEIGHT (KG)")) – val(OBSANY("BIRTH WT KG"))))