exec

Execute an external command. The syntax is

   exec(commandline[, INPUT[, INPUT[, INPUT[, INPUT]]]]);

Allows execution of an external command. The first argument is the command to execute. Any subsequent arguments are written to the standard input of the process. The standard output of the command is read as the return from the function.

This function allows unlimited extensibility of Texis, although if a particular function is being used often then it should be linked into the Texis server to avoid the overhead of invoking another process.

For example this could be used to OCR text. If you have a program which will take an image filename on the command line, and return the text on standard out you could issue SQL as follows:

     UPDATE     DOCUMENTS
     SET        TEXT = exec('ocr '+IMGFILE)
     WHERE      TEXT = '';

Another example would be if you wanted to print envelopes from names and addresses in a table you might use the following SQL:

     SELECT	exec('envelope ', FIRST_NAME+' '+LAST_NAME+'
     ', STREET + '
     ', CITY + ', ' + STATE + ' ' + ZIP)
     FROM ADDRESSES;

Notice in this example the addition of spaces and line-breaks between the fields. Texis does not add any delimiters between fields or arguments itself.


Copyright © Thunderstone Software     Last updated: Jun 9 2017
Copyright © 2017 Thunderstone Software LLC. All rights reserved.