A web page can be a self contained page of pure html stored in the web server store or just the main part loaded into a template. The page consists of a url part telling the server where to load the page from and a code part that is the html code presented to the user when giving the url in the browser. You can also supply optional settings like the template to use and the data to supply the template engine.

Page templates

The page itself uses our DataEase report format consisting of page parts, livetext and tags. These are combined with a DataTree (multiview in DataEase lingo). A DataTree can consist of 1 or more levels of data and statistical data for all the levels. The page consists of a top part for page definition where settings and data are placed, and a body part where the resulting text is generated.

Top part dot commands (page definition)

.data A data definition that is executed before the page is rendered.
.dql Indicates a section holding a dql to be called when you have a single source dql. It must always be started at the first line of the source (or right after .dqlde).
.dqlde Defines comma-separated data-entry field names used by the dql when placed at the top of the file before .dql. Ex. .dqlde FromDate,ToDate
.end Marks the end of the page definition or .dql/.data section.
.name Sets the name of the page. This can then be used in the template header in <title>[{page.name}]</title> to give proper dynamic names in the browser.
.page Set at the top to tell that this is to be loaded by the page engine in the server.
.security The lowest user level this page is allowed to be loaded for. None is all, then you have from Low3 to High that are levels set for the users in the User table.
.template Tells what template to use when loading this page. It is a single line part in the form .template templatename/filename

All of this ends with either a .end or the first .command for the body part like .header or .items.

The body dot commands

A page part always starts at the beginning of a line with a . (dot) and the name of the part. Comments starting with -- on a command line are ignored.

.header
.form header
Indicates the start of a header section. If used before .group header or on a single-level query, it is output once at the top of the report. In a multi-level query without .group header, each .header corresponds to a level from the top of the data tree and down.
.group header A header for use when you group records (for example using in groups in a DQL list records). A group makes two levels in the data tree: the group field at the upper level and the detail fields in the level below. A .group header lets you use both the group field and the fields from the first record in the group together in the same header.
.items
.item
Indicates the start of the detail list at the innermost level in the data tree, regardless of how many headers are given before it. You can also write .items in name to list records from a specific named data source.
.noitems
.noitem
If the query in the page returns no records, the .noitems section is output instead of .items.
.footer
.trailer
.form footer
.form trailer
Outputs footer data after a list of items. The first footer after .items belongs to the level just above the items, the next footer belongs to the level above that, and so on.
.group footer
.group trailer
Outputs the footer for a group after all items in that group have been listed. Here you can output group subtotals (like sum and count) together with the group field name. If you have several group levels, the first .group trailer is for the innermost group, and the next is for the outer group.
.end
.report trailer
.report footer
Ends the repeating .items and footer sections. Any text and LiveText placed after .end is output once at the very end of the page and can be used for grand totals.
.if
.endif
Conditional block. Write .if FieldName on its own line, followed by the text to output, and close with .endif on its own line. The block is only output if FieldName has a value (not blank and not false/no).
.page Adds a page break into the output (<p style="page-break-after:always;"></p>).

LiveText

A LiveText starts with [{ and ends with }]. LiveText inserts data into the document based on the current position in the page. A LiveText can consist of three parts: the field name, the format (after :) and the filter (after |).

Ex.: [{FieldName:R20 sum|replace "," "."}] gets the aggregated sum of FieldName, right-aligns it in a 20 character wide field, and then replaces comma with dot.

LiveText format

The LiveText format is added right after the : character. These format commands pad or format text, numbers, dates, times, and boolean values.

Lsize Left-aligns the value in a fixed width of size characters by padding with spaces at the end. If the text is longer than size, it is truncated. Ex. [{Name:L30}]
Csize Centers the text in a fixed width of size characters by padding with spaces on both sides. If the text is longer than size, it is truncated. Ex. [{OrderDate:C10}]
Rsize Right-aligns the value in a fixed width of size characters by adding spaces in front. If the value is longer than size, it is truncated. Ex. [{Amount:R12}]
Fformat Formats a number using a mask of 9 (space-padded) or 0 (zero-padded) and separators. If you use two different separators in the mask, the first is used as the thousand separator and the second as the decimal separator. Ex. [{LineTotal:F999 999,99}] or [{Code:F00000}]
FF / FF.00 Formats a number as a standard floating point number, optionally with a fixed number of decimals. Ex. [{Price:FF.00}]
FI Formats a number as a whole integer. Ex. [{Quantity:FI}]
Nformat Formats a number by specifying thousand separator before T, decimal separator, number of decimals, and F (float) or I (integer). Ex. [{Total:N,T.2F}]
Dformat Formats a date using DD, MM, and YY or YYYY. Ex. [{OrderDate:DYYYY-MM-DD}] or [{OrderDate:DDD.MM.YY}]
Tformat Formats a time value using HH, MM, and SS, with an optional timezone at the end (+ or +HH:MM). Ex. [{StartTime:THH:MM:SS}]
Bfalse/true Formats a boolean value using the text before / for false and after / for true. Ex. [{Active:BNo/Yes}]

LiveText stats/aggregates

When you ask for statistics on a field in a DQL list records (such as item sum count), you can output those statistics by adding the aggregate name after :. If you also use a format (like R12 or F999.99), add a space between the format and the aggregate name.

item Outputs the normal record value. Ex. [{OrderSum:item}] or [{OrderSum:R10 item}]
sum Outputs the sum for the current group (in a group footer) or for the whole report (after .end). Ex. [{OrderSum:sum}] or [{OrderSum:R10 sum}]
count Outputs the number of records in the group or report. Ex. [{OrderNo:count}]
mean / average Outputs the average value. Ex. [{OrderSum:mean}] or [{OrderSum:R10 average}]
min / minim Outputs the minimum value. Ex. [{OrderSum:min}] or [{OrderDate:DDD.MM.YY min}]
max / maxim Outputs the maximum value. Ex. [{OrderSum:max}]
percent Outputs the percentage of the total. Ex. [{OrderSum:percent}]
variance Outputs the statistical variance. Ex. [{OrderSum:variance}]
stddev / std.dev. Outputs the standard deviation. Ex. [{OrderSum:stddev}]
stderr / std.err. Outputs the standard error. Ex. [{OrderSum:stderr}]

LiveText filters

Filters are added after a | character and convert the output text so it is safe to use in HTML, attributes, URLs, or JSON. You can chain multiple filters by separating them with a space.

html Escapes special HTML characters (<, >, &, ", ', /).
htmlserver Same as html, and also escapes LiveText brackets ([ ] { } |).
attribute / attributeserver Escapes characters so the text can safely be placed inside an HTML attribute.
json / tojsonstring Escapes quotes, backslashes, and line breaks so the value is valid inside a JSON string.
fromjsonstring Unescapes a JSON-escaped string back to normal text.
urlencode / urldecode Encodes or decodes text for use in a URL query string.
replace "old" "new" Replaces occurrences of old with new in the formatted output.

LiveText data context and array lookup

All data from the DQL or data definition is ready before the template starts building the page. Because of this, you do not have to add .items and .end if you only want to show fields from a single record or grand totals on your page. You also do not need to add empty .header, .group header, or .footer sections just to match the number of levels in your query; the template engine automatically simulates any levels you leave out.

LiveText is opportunistic when looking up data: it always checks its current level first, and if the field is not found there, it walks up and down the data tree to find the current value at the level where that field lives. This means you can place any field or total anywhere in the page (even outside .header/.items/.footer) and get the current value.

You can also pick a specific row directly from a list of records by adding .number (where 0 is the first record, 1 is the second record, and so on) to the field name.

[{FieldName.0}]
[{0.FieldName}]
Gets FieldName from the first record (index 0). Use .1 for the second record, .2 for the third, and so on.
[{TableName.FieldName}] Gets FieldName specifically from the named table level.
[{TableName.1.FieldName}]
[{TableName.FieldName.1}]
Gets FieldName from the second record (index 1) of the named table level.
[{data-entry FieldName}]
[{FieldName}]
Gets the value of a DQL data-entry field passed in the URL query or request.

There is also other page data than the data source. All pages have a page context and a user context that are looked up using dot notation, such as [{page.name}] or [{user.username}].

Tags

If the page contains a template name, the generated page code is inserted into the template at the position given by the [%body%] tag.