When displaying a large number of objects, it may be impractical to display all of the data at once. While the approach used in figure See DTML source to create an employee phone listing which properly handles the case of no employees by using an in tag with an if tag. is practical for a small group of employees, it is impractical for browsing the employees of a large company.
For this reason, the in tag provides support for batch processing. Information is displayed in batches. Variables are provided (table See Batch-processing variables) to aid in the construction of HTML hyperlinks to other batches.
The batch-processing facilities of the in tag are quite powerful, but the various options and approaches are complex. For lucidity, take for example a simple table of 36 words (figure See Table of 36 words). The DTML source in figure See DTML source to browse 36 words, 5 words at a time is used to display this data. The DTML uses an if tag to test for an empty sequence of words. The actual sequence is named w36 . Inside the if tag, there are three in tags. All three in tags include the attributes, size with the value 5 and start with the value qs . The size attribute is used to specify a batch size. For example purposes, the batch size is unusually small. The start parameter is used to specify the name of a variable which holds the index of the first element of the sequence to be displayed. If the variable is not defined, then the first batch is displayed. Figure See The output of the DTML source in figure 6 as displayed in a Web browser for several batches. shows the output of the DTML as displayed on a Web browser for the first two and last two batches.
The first of the three in tags is used to display an HTML hyperlink to a previous batch of data. The previous attribute in the in tag indicates that only previous-batch data should be displayed. Row data are not displayed. If the first batch is being displayed, then no text is inserted (figure 7 (words 1-5)). The source in the first in tag uses four variable references. The first retrieves the document_id , which is used as a relative URL name for the document. The second variable reference uses sequence-query to retrieve the request query string which has been modified so that it does not include the variable named in the in tag start attribute, qs . The sequence-query value also contains the necessary punctuation, ` ? ' and ` & ', so that the document_id , sequence-query and URL-encoded value for the next batch start can be concatenated. The URL-encoded value of the next batch start is " qs= " followed by the variable, previous-sequence-start-number . The variable previous-sequence-size provides the size of the previous batch for display in the hyperlink. Note that the previous (or next) sequence size is not necessarily equal to the batch size.
The DTML source has been split over multiple lines by introducing line breaks within var tags. This is a useful way to break up long lines without causing line-breaks to be included in generated HTML.
The second in tag simply displays the rows in the batch. The third in tag is similar to the first in tag, except that a hyperlink to the next batch, rather than the previous batch, is displayed. Table See Query strings and previous batch URL and next batch URL for the batches shown in figure 7 shows the query string, previous batch URL and next-batch URL for the example shown in figure See The output of the DTML source in figure 6 as displayed in a Web browser for several batches..