On this Page

    -filter

    Convert incoming data to Merge-compatible XML format.

    Syntax

    -filter "filterName filterOption1 Option1Value filterOption2 Option2Value ..."

    or

    -filter "filterName filterOption1=Option1Value filterOption2=Option2Value ..."

    A filter can, itself, have many parameters. These parameters need to be shown as separate from the rest of the Merge parameters. Think of the entire filter name and its parameters as a single parameter to Merge – that is what it is. To accomplish that, the entire filter name and its parameters must be enclosed in quotes ("). Within that set of double quotes, there may be filter option values that have special characters. Such filter option values need to be surrounded by single quotes (').

    As usual, one can choose to put equal signs (=) between name and value operands. Note that the equal sign itself is a special character.

    Much of the quoting difficulty can be eliminated by using parameter (.prm) files which are not subject to the whims of various command line interpreters.

    Description

    Typically used to convert incoming data to Merge-compatible XML format. Filters are also used to sort incoming XML into a new order. Another filter could be used to combine several forms into one form for use in the Merge process.

    filterName is the name of a program or JavaScript file that is invoked by Merge to convert the data.

    • If filterName has a .exe extension or has no extension at all, an external (custom) converter is called.
    • If filterName has an extension of xfilter then the built-in DocOriginFilterProcessor.wjsinc conversion facility is used to process the data stream according to the rules you defined via Filter Editor to create the xfilter file.
    • Otherwise filterName is assumed to be a file containing JavaScript that will convert the data. (Typically these have a .wjs extension.)

    When filterName is not a fully qualified file name, it is assumed to be relative to the folder containing Merge.

    filterOption# is an option name that pertains to the filterName being used.

    Option#Value is the value for the preceding filterOption#. The value will have to be surrounded in single quotes if it contains blanks or other special characters.

    Examples

    -filter "ConvertDatToXml -split '^field AccountNo'"

    -filter "uconv -f cp1252 -t utf-8 -o %out %in"

    -filter "DocumentSort -keyname Document.InvoiceHeader.CustomerID -keyname CustomerPO -sortOrder=D

    Multiple Filters

    It is possible to specify multiple -filter options for a single Merge command line invocation. These filters will be run one after the other in the order in which they are specified on the command line, or more likely, in a .prm file.

    Third-Party Filters

    It is possible that an existing executable can be used as a filter. However, it is unlikely that it will expect parameters in a style such as -in filename and -out fileName. When defining the command line parameters for these third-party filters you can supply %in and %out as placeholders for the file names to be used for the filter. Merge will supply those names in a way that is applicable and suitable for chaining multiple filters in a row. See the uconv example above. If you supply neither %in nor %out then Merge will automatically affix -in fileNameIn and -out fileNameOut to the end of the provided command line.

    Normally Merge expects executable filters to be in $E (i.e. DO/Bin). For third-party filters, you will need to specify the applicable path and file name.

    See Also

    Merge Filters