Sample Data
This topic covers issues relating to the sample data used in your PlanetPress Workflow configuration.
A sample data file makes it possible to:
-
Create a process that retrieves dynamic data from a data file. Once a sample data file is available, you can use it to make data selections in a process (see Data selections).
-
Debug a process (see Debugging your PlanetPress Workflow process).
Choosing a sample file sets the process's emulation to the chosen format (see About data emulation). The only other way to change a process's emulation is by inserting a Change Emulation task in it.
Changing the emulation is particularly important if you want to make a data selection in a file after it has been converted to another format or when the job file has changed (see Data selections). To interpret a sample data file correctly, a process must have the corresponding emulation setting.
Even during debugging, selecting a sample data file with a different format will cause the emulation of a process to change. In order to avoid errors, change the emulation back to the format of the original input file before using the process again.
Choosing a sample data file
In order to create your PlanetPress Workflow process, the sample data you are going to use has to correspond precisely to the job files that will be treated by that process, at least in terms of structure.
The sample data file should have a relatively small number of records (generally less than a hundred) in order to be processed quickly, while your actual data may be much larger and take more time to process. The sample data file should also contain at least one of every exception you may want to detect, or data used for a specific condition. For example, if you wanted to filter out any data for clients in Canada, you would want to use a data file that has at least one client from Canada, to test whether your process filters it out correctly.
To choose a sample data file:
-
Click the Debug tab in the PlanetPress Workflow Ribbon.
-
Click on Select in the Data group.
-
Use the Data Selector to choose your sample data file and emulation options (see The Data Selector).
-
Click OK on the Data Selector.
Alternatively, if a resource file available in the configuration contains the necessary data file, it can be attached to the process easily:
-
Expand the relevant resource files folder (Connect Resources or PPS/PSM Documents) by clicking the button.
-
Expand the file by clicking the button.
-
Right-click on the data file, then click Set as sample data file or simply double-click on the data file.
For example, to use a sample data file included in a Connect data mapping configuration: select Connect Resources > Data Mapping Configurations > [your data mapping configuration], right-click a data file and choose Set as sample data file.
Double-clicking on the data file does the same thing as right-clicking on it an then selecting Set as sample data file. Clicking Cancel instead of OK after viewing will prevent this action from being taken.
Choosing a database sample file
To choose a database sample file:
-
Open the Data Selector (see The Data Selector).
-
From the Emulation drop-down list, select Database.
-
Next to the Sample data file field, click the Configure Database button.
-
Associate a database.
- Microsoft Access Database or dBase file: In Database, enter the path of the Microsoft Access database or dBase file, or click the Browse button to the right of the box to navigate to, the database file. Recall that a Microsoft Access database file bears the extension .mdb, and a dBase file bears the extension .dbf. If the file is a dBase file, you must specify the folder that contains the .dbf file. The folder in this case is considered to be the database, while each individual .dbf file is a table in the database. Once you enter the path, the Table/query name box updates to reflect the tables and queries available in the selected database.
- ODBC Data Source: In ODBC Data Source, click to connect to an ODBC Data Source. Use the Select Data Source dialog box that appears to select an existing Data Source or set up a new one. When you exit the Select Data Source dialog box, the Database box updates to display the connection string it uses to connect to the database, and the Table/query name box updates to reflect the tables and queries available in the selected database.
Since the Workflow tool is a 32-bit application, it can only use 32-bit ODBC data sources. Make sure you use the proper Windows application (ODBC Data Sources (32-bit)) to create and manage data sources that can be used in Workflow.
-
Click Edit SQL to create the SQL query by hand to define the SQL query that retrieves the data your document requires.
-
Set the properties that define a record set:
-
Condition: Select the condition that signals the end of a record set. Three possibilities exist: create a new record set for each record, create a new record set after every x records, or create a new record set when the value of a specific field changes.
-
Sort on condition field: Select this if the condition you set is to create a new record set when the value of a specific field changes, and you want to sort the records before applying that condition.
-
Maximum records per record set: Set either the number of records in each record set, or the maximum number of records in a record set. An individual record set can contain a maximum of 4000 records.
-
-
Set the number of records you want to include in the sample data file. The number of records you set should provide a reliable sample to ensure your document executes properly with any of the data it may encounter at runtime.
-
All: Select to include all records in the database in the sample data file.
-
Records: Select to define the range of records you want to include in the sample data file.
-
Entering an SQL query
-
In the Database Connection dialog box, click Edit SQL.
-
If necessary, click Show Tables to display, in the Tables area, a list of the tables available in the database.
-
In the SQL Query Entry area, enter the SQL query. The following two sample queries both retrieve all the fields in the Orders table. The second sorts the resulting records on the Date field.
SELECT * FROM [Orders]
SELECT * FROM [Orders] ORDER BY [Date] -
Click Test SQL to verify the query you entered is a valid SQL query.
-
Define whether you want PlanetPress Design to automatically enclose table names and field names in square brackets.
Alternate syntax(not recommended): Select to prevent PlanetPress Design from automatically enclosing the names of any database tables and fields that appear in the SQL query in square brackets when it exits the advanced SQL Statement dialog box.
-
Client side cursor: Select to download result sets to client computer running the SQL query. Under some circumstances, client side cursors may be slightly less efficient than server-side cursors, but they may also provide additional functionality, depending on the type of query that is issued.
-
Click OK to return to the Database Connection dialog box.
Opening a previously used data file
PlanetPress Workflow also keeps the last 9 used data files in memory, which you can reopen to use in the same process, or in a different one.
To reopen a sample data file:
-
Click the Debug tab in the PlanetPress Workflow Ribbon.
-
Click on Reopen Data File in the Data group.
-
Click on one of the data files in the list.
-
Use the Data Selector to change the emulation options if necessary.
-
Click OK on the Data Selector.