Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Data Across Encounters

Displaying a table with one row per encounter

Code that can be entered into a Report Template:

<%

// Create a table and heading row using HTML

Output.Write("<table border='1' cellspacing='0' cellpadding='5'>");
Output.Write("<tr><th>Encounter Date</th> <th>Encounter Name</th></tr>");

// Loop through the encounters and output the encounter date and encounter name 
   // Each time through will create a row in the table with the next encounter  

for (var index=0; index < ENCOUNTERS.Count; index++) {
     var encounter = ENCOUNTERS.GetEncounter(index);
         var encounterDate = encounter.#EncounterDate;
         var encounterName = encounter.#IntervalName;

   Output.Write("<tr><td>" + encounterDate + "</td>");
   Output.Write("<td>" + encounterName + "</td></tr>");
}

Output.Write("</table>");

%>

An example of the output from the Report Template code above:

Encounter Date

Encounter Name

10/1/2011

Baseline

11/5/2011

Month 1

12/2/2011

Month 2



Displaying data in a custom layout from fixed encounters
 

Code that can be entered into a Report Template:

<%
// Declare variables that will track the interval's index number
   var BaselineIndex="";
   var Month1Index="";
   var Month2Index="";

// Loop through all encounters to assign the interval's index number

for (var index=0; index < ENCOUNTERS.Count; index++) {
  var encounter = ENCOUNTERS.GetEncounter(index);
  var encounterName = encounter.#IntervalName;
      if (encounterName =="Baseline") var BaselineIndex=index;
      else if (encounterName=="Month 1") var Month1Index=index;
      else if (encounterName=="Month 2") var Month2Index=index;
}

// Create variables for each encounter and assign all the values from that encounter to the variables

var BaselineEncounter = ENCOUNTERS.GetEncounter(BaselineIndex); 
var Month1Encounter = ENCOUNTERS.GetEncounter(Month1Index);
var Month2Encounter = ENCOUNTERS.GetEncounter(Month2Index);

// Create the desired layout

Encounter Name

Encounter Date

Variable 1

Variable 2

Baseline

<%=BaselineEncounter.#EncounterDate%>

<%=BaselineEncounter.#Variable1%>

<%=BaselineEncounter.#Variable2%>

Month 1

<%=Month1Encounter.#EncounterDate%>

<%=Month1Encounter.#Variable1%>

<%=Month1Encounter.#Variable2%>

Month 2

<%=Month2Encounter.#EncounterDate%>

<%=Month2Encounter.#Variable1%>

<%=Month2Encounter.#Variable2%>



An example of the output from the Report Template above:

Encounter Name

Encounter Date

Variable 1

Variable 2

Baseline

10/1/2011

128

75

Month 1

11/5/2011

123

60

Month 2

12/2/2011

118

62

  • No labels