Data Across Encounters
Displaying a table with one row per encounter
Code that can be entered into a Report Template:
<%
// Create 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 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);