Script functions reference > Script functions in alphabetical order > W > WriteSubst

WriteSubst
Syntax
WriteSubst(tbl_file);
tbl_file 
Description
Writes a substitution table to a specified path. Any external modifications to the file after it has been loaded are overwritten. See also ReadSubst.
Returns
1
0
Example
The following script writes a substitution file to ../data/tables/author.tbl:
SetSubst("../data/tables/author.tbl","agatha",0,"christie");
SetSubst("../data/tables/author.tbl","agatha",1,"1890");
SetSubst("../data/tables/author.tbl","alfred",0,"hitchcock");
SetSubst("../data/tables/author.tbl","alfred",1,"1899");
WriteSubst("../data/tables/author.tbl");
Result (author.tbl):
//!multicolumn!
agatha christie 1890
alfred hitchcock 1899
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.
If a column index larger than zero has been set using scripts in a non //!multicolumn! marked file, the file will be converted into multi-column when saved, and key values containing white spaces will be converted adding quotes or <hex> notations if necessary.
<hex> notations other than <0d><0a><09> are not kept when saving.
If //!codepage! is specified in the substitution table file, the remaining file will be saved using the given codepage.
The WriteSubst function will automatically add double quotes ("") around empty columns in the table. This is to make sure that the correct value is returned by the GetSubst function, as this function does not take the column separators into account.
OpenText StreamServe 5.6 Updated: 2013-03-01