| Files, Lists & Tables |
| File Formats |
| |
|
In addition to providing a full featured ODBC capability, PSL accepts:
.tab tab delimited text, no field names
.dat tab delimited text, first record contains field names
.csv comma delimited text, no field names
.csn comma delimited text, first record contains field names
.dbf standard dBase II format
The .csn file format is a .csv file. But when PSL sees the “n” it uses the top row as variable names. The .dat is similar for the more usual .tab file format.
|
| |
|
|
| General -- Files, Lists & Tables |
| |
|
For the purpose of this general discussion, we use here file, list and table interchangeably. We’ll use “file” to mean all three.
If files are moved into the project data directory they are easily addressed by name. On the other hand, files can be accessed by the normal Windows file system by path name. Commands exist to make sure that such files exist, etc.
One can read and write to files, “rewind” a file, find the file size, read a file at any index, step back and forth, read or write to a file using a key which is any field in a record, or simply by record number.
If files have the first record showing field names those names can be used easily in a PSL program.
Any number of files can be open and read or written to.
|
| |
|
|
| Attributes Specific to Files |
| |
|
The “merge” file is special in that the PSL program (excepting “Initially” blocks) is run once for each record in a merge file.
Another special file is the “input” file. This is a file containing run time data and specified in the job options dialog box. Fields in the PSL program are assigned values in this file. One simple example would be the date associated with a print run – not necessarily today.
When printing fields in a file There is a “PrintIf Any” command which deals with empty fields. PSL will automatically interleave files for n-up work.
Robust tools for moving about in files, setting indexes, and gaining information about files, such as file size, extension, are available. PSL even, and only as an example, provides commands to find the creation date and last modified date of a file.
|
| |
|
|
| PSL users can find and replace fields in tables, |
| |
|
Search tables for matching values,
Replace values in a table with the return of a function value.
Get a list of all values for a field in a table.
Set Cursor at first entry in table, next entry, or is it the end?
Find the “current” entry, and/or its key
Replace said entry
Find out how many entries are in a table
Copy a table
Move cursor to an entry, or all entries, in a table based on a function
Replace any/all entries in a table based on a function
Make a new table based on values in a table
Find all values of a key
|
| |
|
|
| And, |
| |
|
Make a whole table, into a list
Make a list, using a function if desired, based on a key or values for a table
Make a list based on some function of value or key
Make a new table with key and value exchanged
Make a new table of values indexed by position in table
Make a table containing the entire contents of a file specifying the name of the primary key
Make a table containing the entire contents of a specified file specifying the field to be used as key, a criteria for inclusion or records can be applied
Make a table from a file indexed by name
|
| |
|
|
| And, |
| |
|
Sort tables,
Invert a table,
Make a new table based on a key,
Read an entire table into memory, via ODBC,
Use and write SQL commands, via ODBC
|
| |
|
|
| Table Print Functions |
| |
|
PSL contains over 30 functions for printing tables. A summary of these tools is presented below. In general, the length (vertical dimension) is set automatically by the number of rows printed and that in turn, is variable based on the file length. Users can define:
Row height and column widths,
Background and border colors,
Row colors by providing a list of colors to be cycled through,
Maximum and minimum font sizes permitted so tha PSL can fit data to “boxes”
Font name,
Table header and column names, as well as color and border
Users can;
Cause PSL to use file field names or supply their own,
Print entire records or selected fields,
Print the entire file or part of it,
Cause printing to flow from page to page as needed,
Cause various schemes for horizontal and vertical justification
|
| |
|
|
| List Functions |
| |
|
Lists are just that, lists. PSL users often make lists of; colors for charting and table printing, values for chart making, files to be processed, data extracted from tables, and so on.
Users can navigate about in a list, finding first or last entry, nth item in list, current entry
And, insert values or other lists, append values or other lists or replace or delete these
Sort lists
Reverse them
Make lists of lists (completely recursive)
Find matching values, and,
Make a list from a string or a string from a list
Apply a function to all or selected members of a list
|
| |
|
|
| Search Functions |
| |
|
One can search a file or a table based on a wide variety of criteria including the “rational operators” (<, >, =, etc.)
Soundex searching is implemented
|
| |
|
|
| ODBC Database Functions |
| |
|
PSL supports ODBC connectivity. Consequently the file and table functionality discussed above is supported. As well one can read entire table or selected subsets (dynasets) into memory, search tables, and,
Issue SQL commands and deal with SQL errors.
|
| |
|
| PSL Language Specifications: |
|
|
|
|