Skip to main content
. 2015 Jun 1;3(2):e46. doi: 10.2196/mhealth.4202

Table 3.

A sample of Personal Health Intervention Toolkit logic statements and application programming interface function calls.

Statement Example
Set a variable set {ptHx_age} = “15”;
set {ptHX_gender} = “M”;
Call a function set {age_m} = call calculateAgeInMonths("{ptHx_birthday}");
call Message("Patient birthday must be before today.");
set {iVA_height}=call formatNumber({iVA_height}, 0);
Conditional logic if ("{ptHx_ageMonths}">="0" && "{ptHx_ageMonths}"<="48" &&
      "{iVA_isExposed}")then
   set {iVA_tobaccoCode}="Under4Exposure";
Skip logic if ("{ptHx_ptID}"=="") then goto F0_PtID;
Exit the instrument exit;
Move to next form in form stack if (("{ptHx_today}"-"{ptHx_birthday}")<"{ptHx_one_week}")
      then nextForm;
Nested ifs and while set {randytest_collectId1} = call generateCollectionId();


if ("{randytest_collectId1}">="0") then begin;
   set {iVA_alcoholInstr} = "CAGE";
   set {iVA_alcoholInstrWording} = "past two weeks";
   if ("{randytest_collectId1}" == "0") then begin;
      set {iVA_another} = "foobar";
   end;
set {iVA_alcoholOnQueue} = "foobar";
   set {iVA_alcoholStatus} = "monitoringScheduled";
   set {iVA_i} = 0;
   while ({iVA_i} < 3) begin;
      set {iVA_i} = {iVA_i} + 1;
      if ("{iVA_i}" == "1") then
         set {randytest_zzzz} = "zzzz";
   end;
end;


set {randytest_collectId2} = call generateCollectionId();
var {randytest_abar} = "";
Statement blocks begin;
   set {ptHx_status} = "started";
   set {ptHx_done} = "false";
end;