Data Selections in PReS™ Workflow
A data selection is simply a reference to a given location within the job file or metadata file, using the current emulation. Data selections are always evaluated at runtime so they are always dynamic and depend on the job file that is currently being processed. When you make a data selection, the PReS™ Workflow Configuration program converts it to text form, using coordinates to reference the selected location.
There are three types of data selections you can use in PReS™ Workflow. The available type of data selection depends on which emulation you are using and whether or not you have created Metadata.
You can add data selections to variable properties of your tasks either automatically using the data selector (see The Data Selector) or manually by typing in the data selection.
It is strongly recommended to use the automatic method, as it returns precisely the same selections but is generally more reliable
Text-Based Data Selections
These selections are used for text data files such as Line Printer, ASCII and Channel Skip emulations. The selection refers to a rectangular selection that may contain multiple lines, rows, columns on a given page.
Syntax
@(page number, from line, to line, from column, to column, case option, trim option)
Here is a breakdown of the syntax (all options are mandatory):
- @(): Always surrounds a data selection.
- Page Number: The data page number from which you want the data selection to grab the data. If you want to get data from each page individually, this has to be done after a splitter.
- From Line: The starting line of the data selection.
- To Line: the last line of the data selection.
- From Column: the leftmost character position of the data selection.
- To Column: the rightmost character position of the data selection.
- Case Options: This can be one of three options:
- KeepCase: Keeps the current uppercase and lowercase letters as they are.
- UpperCase: Converts all letters to their uppercase equivalent.
- LowerCase: Converts all letters to their lowercase equivalent.
- Trim Option: Can either be "Trim" if you want to trim empty spaces before and after the data selection or "NoTrim" if you want to retain the extra spaces.
Alternate Syntax
@(line number, from column, to column)
The alternate "quick" syntax lets you grab data from a single line from the first data page in the file. Here is a breakdown of the syntax (all options are mandatory):
- @(): Always surrounds a data selection.
- Line Number: The line from which to get the data.
- From Column: the leftmost character position of the data selection.
- To Column: the rightmost character position of the data selection.
Database Data Selections
These selections are used for database-driven data files such as Database and CSV emulations. The selection refers to a specific field on any given data page.
Syntax
field(record set number, child number, field name, treatment of character case, treatment of empty trailing cells)
Here is a breakdown of the syntax (all options are mandatory):
- field(): Always surrounds database field selections.
- Record Set Number: The data page (or "record") of the data selection.
- Child Number: Line Number in the record (if there are multiple lines returned for one single record).
- Field Name: The name of the field you want to retrieve.
- Case Option: This can be one of three options:
- KeepCase: Keeps the current uppercase and lowercase letters as they are.
- UpperCase: Converts all letters to their uppercase equivalent.
- LowerCase: Converts all letters to their lowercase equivalent.
- Trim Option: Can either be "Trim" if you want to trim empty spaces before and after the data selection or "NoTrim" if you want to retain the extra spaces.
PDF Data Selections
These selections are used for PDF data files. The selection refers to a specific area of any given page of the PDF by using precise region coordinates (in inches).
Syntax
region(page, left, top, right, bottom, case option, trim option)
Here is a breakdown of the syntax (all options are mandatory):
- region(): Always surrounds PDF data selections.
- Page: The page of the PDF from which to retreive the data.
- Left: Exact horizontal position (in inches) that defines the left of the selection region.
- Top: Exact vertical position (in inches) that defines the top of the selection region.
- Right: Exact horizontal position (in inches) that defines the right of the selection region.
- Bottom: Exact vertical position (in inches) that defines the bottom of the selection region.
- Case Option: This can be one of three options:
- KeepCase: Keeps the current uppercase and lowercase letters as they are.
- UpperCase: Converts all letters to their uppercase equivalent.
- LowerCase: Converts all letters to their lowercase equivalent.
- Trim Option: Can either be "Trim" if you want to trim empty spaces before and after the data selection or "NoTrim" if you want to retain the extra spaces.
Metadata Selections
These selections are used with any type of file, as long as a metadata file was created by a previous task.
Syntax
GetMeta(Field Name [, Option Flags, Metadata Path])
Here is a breakdown of the syntax:
- GetMeta(): Always surrounds metadata selections.
- Field/Attribute Name: specifies the name of the field (or attribute, if the GetAttribute option flag is set) to retrieve.
- Option Flag (optional): Sets the options for the selection (see table below)
- Metadata Path (optional): Defines the precise path where the Metadata Field is located.
Option Flags
Name
|
Value
|
Behavior
|
GetAttribute |
1 |
Search for the name argument in the attribute collection instead of the default field collection. |
NoCascade |
2 |
Search only the level specified by the path argument (defaults to Page level when path argument is empty), instead of default behavior, going from the Page level to the Job level. |
FailIfNotFound |
4 |
Raise an error and crash the job is the specified name is not found instead of returning an empty string. |
SelectedNodesOnly |
8 |
Returns values from the selected nodes only. |