Script functions reference > Script functions in alphabetical order > E > EraseSubst

EraseSubst
Syntax
EraseSubst(tbl_file);
Description
Removes the specified substitution table from memory. It does not affect the physical file stored on disk, only the representation of the table in the memory.
The EraseSubst function is similar to ClearSubst:
EraseSubst removes the table from the memory.
ClearSubst clears the table contents but keeps the actual table in the memory.
A substitution table is kept in memory until EraseSubst is called for that table. This means StreamServer performance will be affected if several tables are created in a job, and if the tables are never removed from memory during the job using the EraseSubst function. For example, if you use variables in the table names, you must make sure there are a limited number of tables in the memory. In this case you must call EraseSubst for each table after it is used.
If you use ClearSubst, and then access the substitution table with for example GetSubst, an empty string will be returned. If you access the table after using EraseSubst, the table will be re-read from disk, and a value will be returned.
Returns
1
Example
In this example, the ID of the previous document is copied to the current document, and the substitution table of the previous document is removed from memory and from disk. The variable $documentID is defined in the Event. Its value comes from the input data. The variable $prevDocumentID is the ID of the previous document.
$prevSubTable = "document_" + $prevDocumentID + ".tbl";
$subTable = "document_" + $documentID + ".tbl";
$prevDocumentType = GetSubst ($prevDocumentName, "type", 0);
$documentType = $prevDocumentType;
ReadSubst ($subTable);
SetSubst ($subTable, "type", 0, $documentType);
WriteSubst ($subTable);
EraseSubst ($prevsubTable);
FileDelete ($prevsubTable);
OpenText StreamServe 5.6 Updated: 2013-03-01