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> <th>Variable 1</th> <th>Variable 2</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;
var variable1value = encounter.#Variable1;
var variable2value = encounter.#Variable2;
Output.Write("<tr><td>" + encounterDate + "</td>");
Output.Write("<td>" + encounterName + "</td>");
Output.Write("<td>" + variable1value + "</td>");
Output.Write("<td>" + variable2value + "</td></tr>");
}
Output.Write("</table>");
...
An example of the output from the Report Template code above:
Encounter Date | Encounter Name | Variable 1 | Variable 2 |
10/1/2011 | Baseline | 128 | 75 |
11/5/2011 | Month 1 | 123 | 60 |
12/2/2011 | Month 2 | 118 | 62 |
Displaying data in a custom layout from fixed encounters
Code that can be entered into a Report Template:
...
for (var index=0; index < ENCOUNTERS.Count; index++) {
var encounter = ENCOUNTERS.GetEncounter(index);
var encounterName = encounter.#IntervalName.displayValue.toString();
if (encounterName =="Baseline") var BaselineIndex=index;
else if (encounterName=="Month 1") var Month1Index=index;
else if (encounterName=="Month 2") var Month2Index=index;
}
...
// Create the desired layout
Variable | Baseline | Month 1 | Month 2 |
---|---|---|---|
Encounter Date | <%=BaselineEncounter.#EncounterDate%> | <%=Month1Encounter.#EncounterDate%> | <%=Month2Encounter.#EncounterDate%> |
Variable 1 | <%=BaselineEncounter.#Variable1%> | <%=Month1Encounter.#Variable1%> | <%=Month2Encounter.#Variable1%> |
Variable 2 | <%=BaselineEncounter.#Variable2%> | <%=Month1Encounter.#Variable2%> | <%=Month2Encounter.#Variable2%> |
...
An example of the output from the Report Template above:
Variable | Baseline | Month 1 | Month 2 |
---|---|---|---|
Encounter Date | 10/1/2011 | 11/5/2011 | 12/2/2011 |
Variable 1 | 128 | 123 | 118 |
Variable 2 | 75 | 60 | 62 |
...