Introduction:
JTDataPrep will indiscriminately replace a string with a desired string. The difference with JTConditionalDataPrep is that it requires a condition or string to exist before applying the functionality of JTDataPrep.
Technical Support:
If you need assistance in installing and configuring JetTrac ConditionalDataPrep™, call Pro Technology Automation, Inc. at 805-527-1248 or email us at support@protechinc.com. Please note that the JetTrac ConditionalDataPrep™ license fee does not cover configuration services and technical support so there may be an additional charge. Please ensure you read these instructions carefully before calling for technical support.
How to run JetTrac ConditionalDataPrep:
To run the program, you will need to have the following files located in the same folder:
- JTConditionalDataPrep.jar
- ExitHandler.dll
The JTConditionalDataPrep.jar and ExitHandler.dll files are required for the program to run and should never be edited.
Default Functionality:
This module performs one or more string replacements based on a set condition. The module is similar to JetTrac DataPrep in functionality with the added ability to set a conditional string, which if found in the file, the module will perform the replacement.
Job Step Configuration Window for JetTrac ConditionalDataPrep:
When setting up a job step using JTConditionalDataPrep in JobConfig the only lines of the config you need to worry about are the first and the last two, the Config file, the Input XML and Output XML. If left as an asterisk * the input will be whatever file is in the data folder that triggered the job running. This works well if it’s the first step but if the input is also the output of a previous job step you would need to specify the fully qualified path of the XML you want to edit. from. Eg: C:\JetTrac\…\input.xml
In JobConfig, file paths entered should not be in quotes.
As with all modules, there is a dropdown to select whether or not the job should stop completely if this step fails. If you select Yes, any error will terminate the job process and write to the log file what happened, if no, then the job will try to continue anyways. However if any steps further down the line rely on the output of a job set to not stop on error, they may not work properly
For more specifics go to the JetTrac Field ServiceJobConfig page.
JetTrac ConditionalDataPrep Command Line:
The command line for JetTrac ConditionalDataPrep contains the location of the .jar file, the input XML that you wish to run through the module, the XML that is outputted after the module conditionally replaces strings of data, the configuration .ini file which contains the conditional string as well as the replacement to be made, and the log file to output the status as well as any errors.
java –jar C:\JTConditionalDataPrep.jar “C:\JTConditionalDataPrep_Input.xml” “C:\JTConditionalDataPrep_Output.xml” “C:\JTConditionalDataPrep.ini” “C:\JTConditionalDataPrep.log”
Each part of the line is divided by spaces (the amount doesn’t matter), and contains the fully qualified file path to the file you are referencing surrounded by quotes. In the example all of the file paths reference the root of C:\, however, it is likely that none of these files will be located in the root of C:\ for your system, so this is simply demonstrating that the full file path is required. The command line begins with the path to the module’s executable file, followed by the path to the input XML, the desired path for the output XML, the file path for the config file and then ends with the path to the log file.
Configuration File:
The following is a sample configuration .ini file for JetTrac ConditionalDataPrep as well as a description as to what each line does:
ConditionalString=<ConditionalCheckbox>Yes</ConditionalCheckbox>
StringToReplace=123456
ReplaceStringWith=987654
AlwaysOutput=N
- The ConditionalString key value should be a string found within the XML. JetTrac ConditionalDataPrep will look through the input XML file for this exact string and if the string is found will process the string replacement detailed on lines 2 and 3 of the .ini file. If this string is not found, no string replacement will be performed.
- StringToReplace refers to the string that will be replaced by the value on line 3 of the .ini file if the string on line 1 is found within the XML. This string can be any string of characters.
- ReplaceStringWith is what will replace the string found on line 2 if the conditional string on line 1 is foudn within the XML. This string can also be any string of characters.
- The AlwaysOutput key value can either be a Y or N. If set to Y for yes, the module will always output a new XML file, even if there were no string replacements performed. A N for no will prevent the module from outputting a new XML file if no string replacements are performed.
In the example configuration .ini above the module will look for <ConditionalCheckbox>Yes</ConditionalCheckbox> within the XML file. If this is found then it will look for any and all instances of 123456 within the XML input file and replace them with 987654. If <ConditionalCheckbox>Yes</ConditionalCheckbox> is not found within the XML input, no string replacement will be performed and thus no output XML file will be created.
The typical use case of ConditionalDataPrep is to kick off another job depending on the value of a field. The following is a sample configuration file doing this:
ConditionalString=<SendCoverPageToCustomer>Yes</SendCoverPageToCustomer>
StringToReplace=<?xml version=”1.0″?>
ReplaceStringWith=<?xml version=”1.0″?><?JtJob SendInvoiceCopyToCustomer?>
AlwaysOutput=N
This configuration file takes an input XML that was extracted from a PDF, checks the value of a checkbox named “SendCoverPageToCustomer”, and adds a Job Card value to the XML so that the XML can be dropped into the data folder to run an additional job named SendInvoiceCopyToCustomer.