I can't get this expression to self calculate and populate the OBSNOW("BMI") field.
{OBSNOW("BMI") = str(CalcBMIConv(gHEIGHT,gHEIGHTPREV,gWEIGHT))
}
{fn CalcBMIConv(heightnow,heightprev,weightnow)
{ local heightval = ""
cond case heightnow <> ""
heightval = heightnow case heightprev <> ""
heightval = heightprev
else heightval = ""
endcond
if weightnow == "" or heightval == "" or val(weightnow) == 0 or val(heightval) == 0
then return ""
endif
if heightval == 0 then return str(0)
endif
return str((weightnow / 2.2) / ((heightval / 39.4)^2))
}}
It won't populate my OBSNOW("BMI") data display, I even tried changing it to an edit field.
You dont show where you populate your globals gHEIGHT,gHEIGHTPREV,gWEIGHT, I suspect that may be the problem. I use this instead on my form with the function you have.
{DOCUMENT.TEMP_veHEIGHTNOW = OBSNOW("Height")}
{DOCUMENT.TEMP_veHEIGHTPREV = OBSPREV("Height")}
{DOCUMENT.TEMP_veWEIGHTNOW = OBSNOW("Weight")}
{DOCUMENT.BODY_MASS_IN = str(CalcBMIConv(DOCUMENT.TEMP_veHEIGHTNOW,DOCUMENT.TEMP_veHEIGHTPREV,DOCUMENT.TEMP_veWEIGHTNOW))
OBSNOW("BMI",DOCUMENT.BODY_MASS_IN)}
I did see that posted else where and did try using it but still can't get it to calculate and connect to it. I'm probably doing something wrong else where. I also tried making it a watcher with the exclamation point. It just doesn't seem to populate.
Hmm... Mine is an edit field connected to DOCUMENT.BODY_MASS_IN, did you run a trace yet? I dont see anything wrong with the code, as long all of it is in the code panel on the right, it should work
10/24/2013 16:39:34.682 INFO Process Id #2864 Thread Id #1 [MelTrace] --------------------------------------------------------------
10/24/2013 16:39:34.682 INFO Process Id #2864 Thread Id #1 [MelTrace] -- Starting MELTrace on 10/24/2013 4:39 PM for WSID 6220 RDP-Tcp#0
10/24/2013 16:39:34.682 INFO Process Id #2864 Thread Id #1 [MelTrace] --------------------------------------------------------------
10/24/2013 16:39:36.518 INFO Process Id #2864 Thread Id #1 [MelTrace] >{OBSNOW('HEIGHT','73')}
10/24/2013 16:39:36.519 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call OBSNOW("HEIGHT", "73")
10/24/2013 16:39:36.549 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.549 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {global F5772_899_1382647127 = OBSNOW("BMI") ""}
10/24/2013 16:39:36.549 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("BMI")
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>F5772_899_1382647127 = ""
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.550 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {global F5772_898_1382647127 = OBSNOW("WEIGHT") ""}
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("WEIGHT")
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>F5772_898_1382647127 = ""
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.551 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {global F5772_897_1382647127 = OBSNOW("HEIGHT") ""}
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("HEIGHT")
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"73"
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>F5772_897_1382647127 = "73"
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] >>>
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {CFMT(F5772_897_1382647127, "", "Height ", "B", "Inches\par ")}
10/24/2013 16:39:36.552 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>call CFMT("73", "", "Height ", "B", "Inches\par ")
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>>"\b Height \b0 73Inches\par "
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>end
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>>"\b Height \b0 73Inches\par "
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>Done with trigger
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.553 INFO Process Id #2864 Thread Id #1 [MelTrace] >>>
10/24/2013 16:39:36.555 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {/*VARIABLES FOR MEL BUILT-IN SYMBOLS USED IN FORM*/\par }
10/24/2013 16:39:36.555 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>end
10/24/2013 16:39:36.555 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>>NULL
10/24/2013 16:39:36.555 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>Done with trigger
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace] >>>
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {/*START OF FORM TRANSLATION BODY*/\par }
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>end
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>>NULL
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>>Done with trigger
10/24/2013 16:39:36.556 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"73"
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {LAST_SIGNED_OBS_VALUEDATE('HEIGHT')}
10/24/2013 16:39:36.565 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call LAST_SIGNED_OBS_VALUEDATE("HEIGHT")
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"72 (09/17/2013 10:55:05 AM)"
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"72 (09/17/2013 10:55:05 AM)"
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {LAST_SIGNED_OBS_VALUEDATE('WEIGHT')}
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call LAST_SIGNED_OBS_VALUEDATE("WEIGHT")
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"160 (09/17/2013 10:55:05 AM)"
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"160 (09/17/2013 10:55:05 AM)"
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.566 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {OBSNOW('HEIGHT')}
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("HEIGHT")
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"73"
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>"73"
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.567 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {OBSNOW('WEIGHT')}
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("WEIGHT")
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.569 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] >>
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] Fire trigger: {OBSNOW('BMI')}
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>call OBSNOW("BMI")
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>end
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] results>>""
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>>Done with trigger
10/24/2013 16:39:36.571 INFO Process Id #2864 Thread Id #1 [MelTrace]
10/24/2013 16:39:36.574 INFO Process Id #2864 Thread Id #1 [MelTrace] results>"73"
10/24/2013 16:39:36.574 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>end
10/24/2013 16:39:36.574 INFO Process Id #2864 Thread Id #1 [MelTrace] results>"73"
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] >{OBSNOW('WEIGHT')}
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call OBSNOW("WEIGHT")
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>end
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] >{ OBSNOW('PROBLEMS REV') }
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call OBSNOW("PROBLEMS REV")
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>end
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] >{ OBSANY('PROBLEMS REV') }
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call OBSANY("PROBLEMS REV")
10/24/2013 16:39:36.594 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.595 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>end
10/24/2013 16:39:36.595 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.595 INFO Process Id #2864 Thread Id #1 [MelTrace] >{get(getfield(get(getfield(List_Obs('PROBLEMS REV','Signed','Delimited','value'),"|",""),1),"^",""),4)}
10/24/2013 16:39:36.595 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call LIST_OBS("PROBLEMS REV", "Signed", "Delimited", "value")
10/24/2013 16:39:36.595 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
the only thing on that mel trace is the bmi section as I removed everything else prior to tracing.
Scott Forest said:
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] >{OBSNOW('WEIGHT')}
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>call OBSNOW("WEIGHT")
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] execute>end
10/24/2013 16:39:36.589 INFO Process Id #2864 Thread Id #1 [MelTrace] results>""
It looks like the Weight is blank, it requires both to produce a result
thats odd... I tabbed thru it height, then weight, then BMI
Send me your email address and I can send you a little working sample .dlg, maybe that will help