Document Templates : DGL Statements : Output Statements : Include Table Statement

Include Table Statement

Statement Syntax:

stm_table_simple (title, columns, contents, page_width, page_height, anchor);

This statement generates a simple table. You specify the number of columns and their width, and the information to be included in the table. The parameters are as follows:

title is the title of the table. The title appears centered over the table.
columns is a list of integers that specify the width of each column in number of characters. For instance: {16} & {16} & {20} specifies a table having three columns, the first two columns being 16 characters wide and the last column being 20 characters wide.
contents is a list of strings containing the information to be entered into each cell of the table. The information fills the table horizontally, row by row, depending on how many columns were specified. For instance, if you specified three columns in the columns parameter, the following contents:

{’Project Name’} & {’Date’} & {’Location’} &
{’Alpha’} &{’April 1987’} & {’Boston’}

would produce this table:

 

 

page width determines the width of the page in inches. It is only relevant for Interleaf - for other systems, you may specify 0.0 for this parameter.
page_height determines the height of the page in inches. It is only relevant for Interleaf - for other systems, you may specify 0.0 for this parameter.
anchor, relevant only for Interleaf. A character string indicates where to place the table. The options are ‘A’ - at anchor, ‘F’ - following anchor. The default is ‘F’.

For formatters other than Interleaf, precede the table with your system’s no fill and no adjust formatting commands.

The following is an example of how a table can be generated using function calls. Notice how we repeatedly assign new values to the List_str variable to build the table.

Also note that the first statement uses the NROFF commands for
no fill (.nf) and no adjust (.na). These commands cause the word processor to take the text “as is.” Some word processors see this mode as “verbatim” or “literal.” The last statement uses the NROFF commands (.fi) and (.ad) to return to fill and adjust modes.

WRITE (’\n.nf \n.na \n’);

BEGIN
List_str:={’ACTIVITY NAME’} & {’ID’} & {’LANGUAGE’};‘
act_list:=stm_r_ac_logical_desc_of_ac({act_chart},st);
FOR act IN act_list LOOP
List_str:=List_str & {stm_r_ac_name(act,st)};

attr_list:=stm_r_ac_attr_val(act,’ID_NUMBER’,st);

IF (st = stm_success) THEN
attr_val:=stm_list_first_element(attr_list,st);
List_str:=List_str & {attr_val};
ELSE
List_str:=List_str & { ’N/A’};
END IF;

attr_list:=stm_r_ac_attr_val(act,’LANGUAGE’,st);
IF (st = stm_success) THEN
attr_val:=stm_list_first_element(attr_list,st);
List_str:=List_str & {attr_val};
ELSE
List_str:=List_str & {’N/A’};
END IF;
END LOOP;

WRITE (’\n.nf\n.na\n’);
title := ’Table CC1. Simple Table Example’;
Col_list := {16} & {10} & {40};
stm_table_simple(title,Col_list,List_str,pg_w,pg_h, ‘A’);
WRITE (’\n.fi\n.ad\n’);
END;

The formatted output: