Arbortext Command Language > Functions by Alphabetical Listing > tbl_model_operation
  
tbl_model_operation
result = tbl_model_operation(opcode, toid, ...)
This function requests a table-model-specific function. The parameters and result value are determined by the operation requested by opcode.
All operations are supported for tables managed by the OASIS Exchange table model.
No operations are supported for tables managed by the HTML, XSL-FO, or PTC Arbortext table models.
toid specifies different items based on the value of opcode. opcode can be 0, 1, 2, 3, 4, or 5.
If opcode is 0, all colspec tags within thead or tfoot tags are deleted, and every entry tag in the table is adjusted to refer to the colspec tags that are children of the tgroup tag.
When opcode is 0, toid can specify any of the following items and resulting actions by Arbortext Editor:
A selection object — Arbortext Editor processes every object.
A table set (TSet) — Arbortext Editor processes every grid in the set.
A grid (TGrid) — Arbortext Editor processes the corresponding TGroup.
A row, column, or cell — Arbortext Editor processes the containing TGrid.
If opcode is 1, Arbortext Editor deletes spanspec tags and updates entry tags to refer to colspec tags. If the document type does not allow namest or nameend attributes on entry tags, tbl_model_operation does nothing.
When opcode is 1, the toid parameter is interpreted in the same manner as when opcode is 0.
If opcode is 2, Arbortext Editor updates the colname attribute of every colspec tag in a table.
When opcode is 2, the toid parameter is interpreted in the same manner as when opcode is 0.
When opcode is 2, tbl_model_operation takes up to 3 additional parameters: colroot, leftcolspec, and increment.
colroot is a quoted string containing the characters %d specifying the root column name. (For example, "column%d".) %d is replaced with 0 for the left-most column, 1 for the next left-most, and so on. If colroot does not contain %d, %d is appended to the specified string. If colroot is omitted, "col%d" is used.
leftcolspec specifies the number to be used for the left-most <colspec> in the table. If leftcolspec is omitted, 0 is used.
increment specifies the increment to be used during the renaming process. If increment is omitted, 1 is used.
For example, a subroutine call such as
$x=tbl_model_operation(2, toid, "column%d", 5, 2)
causes Arbortext Editor to rename the <colspec> tags to column5, column7, column9, and so on.
If opcode is 3, Arbortext Editor scans a table and reorganizes the attributes of the various table tags to minimize the number of attributes required to describe the table.
When opcode is 3, toid specifies a TSet or any table object. Arbortext Editor processes the TSet.
If opcode is 4, Arbortext Editor renames a single colspec tag by updating the tag's colname attribute and adjusting all spanspec and entry tags to refer to the colspec by its the new value for the colname attribute.
When opcode is 4, the toid parameter is interpreted in the same manner as when opcode is 2.
When opcode is 4, tbl_model_operation takes up to 3 additional parameters: colexam, oldspecname, and newspecname.
colexam is a numeric value of 0, 1, 2, 3, or 4.
0Arbortext Editor examines all colspec tags.
1Arbortext Editor examines only the colspec tags in a thead.
2Arbortext Editor examines only the colspec tags in a tfoot.
3Arbortext Editor examines only the colspec tags in the top level in a tgroup.
oldspecname is a quoted string specifying the colspec to be renamed. (That is, the colspec with colname=oldspecname.)
newspecname is a quoted string specifying the new name of the colspec.
For example, a subroutine call such as
$x=tbl_model_operation(4, toid, 0, "col1", "column1")
causes Arbortext Editor to rename any colspec named col1 to be named column1, and to update all spanspec and entry tags that referred to the old colspec name.
If no colspec has the name specified by oldspecname, tbl_model_operation does nothing. If another colspec already has the name specified by newspecname, tbl_model_operation generates an error.
If opcode is 5, Arbortext Editor renames a single spanspec tag by adjusting the tag's spanname attribute and modifying every entry tag that refers to it.
When opcode is 5, the toid parameter is interpreted in the same manner as when opcode is 2.
When opcode is 5, tbl_model_operation takes 2 additional parameters: oldspanname and newspanname.
oldspanname is a quoted string specifying the spanspec to be renamed.
newspanname is a quoted string specifying the new name of the spanspec.
For example, a subroutine call such as
$x=tbl_model_operation(5, toid, "span1", "span2")
causes Arbortext Editor to rename any spanspec named span1 to be named span2, and to update all entry tags that referred to the old spanspec name.
If no spanspec has the name specified by oldspanname, tbl_model_operation does nothing. If another spanspec already has the name specified by newspanname, tbl_model_operation generates an error.