This is an example of an HTML message with a table created by using code,
rather than explicitly writing it out. Using code provides more flexibility in
formatting the data and making changes to the table. The code is written into an
ASP file named CreateTable.asp, and its contents are given
below. If the DataHub instance is configured to send this file as the message body,
and the DataSim's UpdateFrequency is changed to, say, 102,
the DataHub instance will email this message:

<html>
<style>
BODY, P, TD{
background-color : White;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 8pt;
}
TH{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size: 9pt;
font-weight: bold;
background-color: #cce6fe;
}
.highlight{background-color:#FFFFCC; text-align:right}
.warning{color: #FF0000; font-weight: bold;}
</style>
<body>
<p></p>
<div class="warning">Warning: The DataSim UpdateFrequency has
been set to greater than 100Hz.</div>
<p></p>
Current DataSim status is
<p></p>
<table border="1">
<tr>
<th width="180">Name</th><th width="80">Value</th>
<th width="80">Quality</th><th width="160">Timestamp</th>
</tr>
<%
require ("Time");
require ("Quality");
try
{
local v, q, tm, ts, info;
with pt in [ #$DataSim:Sine, #$DataSim:Ramp, #$DataSim:Square,
#$DataSim:Triangle, #$DataSim:UpdateFrequency,
#$DataSim:Amplitude, #$DataSim:Frequency,
#$DataSim:Offset ] do
{
info = PointMetadata (pt);
v = eval (pt);
if (!number_p(v)) v = 0;
q = GetQualityName (info.quality);
ts = PointGetUnixTime (pt);
tm = format ("%19.19s.%03d", date(ts), (ts % 1.0) * 1000);
%>
<tr><td><%= pt %></td>
<td class="highlight"><%= format("%.4f",v) %></td>
<td align="center"><%= q %></td>
<td align="center"><%= tm %></td></tr>
<%
}
}
catch
{
princ (_last_error_, "\n");
print_stack (nil, _error_stack_);
}
%>
</table>
</body>
</html>
This file consists of HTML code interspersed with Gamma code. Gamma is the scripting language of the DataHub program. The Gamma code is often used to determine the value of a DataHub point, with the following syntax:
<%=$domainname:pointname%>
The pointed brackets and percent signs (<% ... %>)
indicate to the DataHub instance that this is Gamma code. The equals sign
(=) tells the Gamma engine to evaluate the expression,
and the dollar sign ($) tells the Gamma engine that this is
a DataHub point. Other Gamma statements and functions used in this example
include require, try, local, with, if,
format, catch, princ, and print_stack. The
functions GetQualityName and
PointGetUnixTime are from the required files
Quality.g and Time.g
respectively.