Script functions reference > Script functions in alphabetical order > G > GetSubstColCount

GetSubstColCount
Syntax
GetSubstColCount(tbl_file, str_key);
tbl_file
str_key
Description
Returns the number of columns in the entry specified by str_key in the substitution table tbl_file. The column count includes any empty columns.
Returns
num
0
Examples
Example 60
In this example, the following substitution table (author.tbl) is used.
//!CodePage UTF8!
//!multicolumn!
agatha christie  1890
alfred hitchcock 1899
The following script returns the number of value columns for the entry with the key agatha:
$numCol = GetSubstColCount("../data/tables/author.tbl", "agatha");
When the script is run, the variable $numCol gets the value 2.
 
Example 61
The StreamServer does not keep empty columns. If you need a fixed number of columns, you must use a value indicating an empty value. You can, for example, use (void) as indicator.
In this example, the following substitution table (author.tbl) is used.
//!CodePage UTF8!
//!multicolumn!
agatha christie  (void) 1890
alfred hitchcock (void) 1899
The following script returns the number of value columns for the entry with the key agatha:
$numCol = GetSubstColCount("../data/tables/author.tbl", "agatha");
When the script is run, the variable $numCol gets the value 3.
 
Notes
For backwards compatibility, Subst and SubstArr do not remember comments made in the substitution file. If you want WriteSubst to keep your comments, call GetSubst before any other substitution function accesses the substitution file.
OpenText StreamServe 5.6 Updated: 2013-03-01