Sample Configuration: Scenario Configuration
The sample scenario example_scenarioConfig.json is limited to file system inputs and file system outputs. In this way, no external systems need to be connected. The XML file is read in, and newly generated XML files with a modified structure are output.
Input
The sample configuration contains an XML input file with the name example_inputData.xml. This file is first read in via the general input system "InputSystem" of type "File," as any file would be.
The first interpretation of content as an XML file takes place with the input format "InputFormat" of type "Xml." The file contains two documents. The input data is structured in a batch with these two documents. The .DocNode property is used to specify the XML node level at which a separate document is to begin. Later, the documents will be output individually, i.e., the shared stack will not be retained.
Additionally, the input format reader extracts file attachments. In the present case, the file attachments are embedded directly as binary data and defined via .AttachFileMode, which is where the information is stored describing which node the binary data, and where the associated file name can be found.
Tracking values are generated as examples via Input.TrackingIdMacro and Input.TrackingKeyMacro. These values are mainly used in interaction with other xSuite applications. Macro functions that generate a unique UUID (GetUuid()) or a counter value managed in the database (GetDbCounter()) are used to generate the values.
Process
In the "Process" step, the index values are extracted from the documents using the "ProcessReadIndex" index data reader of type "Xml." You cannot use *.xml as a filter for the respective index file, as this would also include the original XML file. During input format processing, the original file was split into document-specific files with the addition split in the file name. This addition in the file name is now filtered for.
As an example, some values of different data types are read in. The target fields for this are defined in the field catalog (FieldCatalog). The source fields are assigned to the target fields in the .Field list of the index data reader. The names of the source fields (. InputName) are specified in XPath syntax. This syntax describes the path to the respective node in the XML file. All values are initially read in text form. How this value is to be determined as a date is therefore explicitly defined (.InputFormat). A format specification is not absolutely necessary for the numerical value, as this value is correctly interpreted implicitly. A prerequisite for implicit recognition is that the value is declared as a numerical value in the field catalog (.InitType). If the numerical value is not declared as such in the field catalog, the value is adopted as a pure text value, which is disadvantageous for subsequent calculation operations.
In the case of tabular item data fields, the . ItemNode property of the index data reader explicitly specifies the XML node under which the data of an item data line is located. If this information is missing, a search is carried out across all occurrences of a field in the XML file. This can lead to incorrect item assignments if a field is not present in all lines (e.g., as a result of the field omitted due to an empty value).
The . InitMacro property of the field catalog fields uses the first two fields to define how these fields can be assigned an initial value using a field macro expression if the field values are not to be read from the input data. This property also defines how a read input value can be subsequently changed. In the first case, the value of the internal tracking ID property is assigned to a field in the form of the corresponding document variable, allowing this value to be transferred to the output file at a later time. Normally, this is not necessary because the transfer of tracking values is implicit in xSuite systems that support these values. Auxiliary fields are not created for this purpose. In the latter case, a fixed character is added to the input value, whereby the original value is addressed via a reference of the field to itself in the form of a field variable.
The initialization macros described are a special variant for pre-assigning values to fields directly when creating the field catalog. Alternatively, new values can be assigned to the fields in the general macro section (ProcessMacro), in which case the field macros will not be assigned to a specific field. Such an expression must therefore be formulated as an assignment, i.e. the target field to which the result value of the macro execution is to be transferred must be explicitly defined. The example is limited to assignments such as these for two other fields. This is a calculation operation for the numeric field and for the date field. However, document macros and file macros can also be used as additional macro types at this point.
Output
Output takes place in two steps. The first step is the creation of an output format (OutputFormat) in the form of a new XML file attachment. The second step is the transfer of this file to an output system (OutputSystem). In the sample configuration, the transfer to an output system consists of writing to the file system. Multiple output formats and output systems can be linked together as required. The processing sequence is specified via the .Order property. A single XML output file example_outputData_1.xml is supplied in the example. This output file can be used to understand the following explanations on the structure of such a file without having to execute the scenario. The XML input file comprises several documents that are output as individual documents. The numerical value in the output file name (.FileName) is a counter with the document number.
The configuration of the "Xml" output format is similar to the configuration of the "Xml" index data reader. In the .Field list, the source fields from the field catalog are assigned to the target fields (.OutputName), which are output in the XML file. The output file has a different structure from the XML input file. The field names and field values are not output in one XML node, but in two parallel XML nodes. The output name is therefore made up of multiple sub-parameters. These sub-parameters are XPath expressions for the name and value nodes and the field names that are output in the name node.
As with the index data reader, the .ItemNode property defines the XML node under which the data of an item line is summarized. This node is repeated by name. An XML node must also be defined for the header fields and the fields below an item line (.FieldNode and .ItemFieldNode). The nodes of these fields are also repeated by name and can only be distinguished by the field names listed in the sub-nodes.
The file attachments directly are embeded in the XML input file. For the output (.AttachFileMode), references are used to separate attachment files. The attachment files will not be physically output until they reach the next output system. However, the file references must be inserted into the XML file at the creation stage of the output format. On the input side, the file attachments in the example are text files that are sent through unchanged. A filter is therefore set to text files (.AttachFileFilter) for the output-side selection of these attachments. The nodes under which the references and their associated file names are to be generated are specified in .AttachFileNode. In .AttachFileRefMacro, a macro expression is used to specify how the references are structured in terms of content. To generate unique file names, the references here are made up of the internal UUID of a file attachment and its name.
A suitable file name filter (.FileFilter) is set for the output system. This filter is used to select the newly created XML output files and the associated text file attachments as the output format. It is important to differentiate between cases when determining the output file name via macro expression (.OutputFileMacro). The XML output files are output unchanged under the name under which they were created. The associated text file attachments, on the other hand, must be given exactly the customized file name under which they were inserted as a reference in the output format (composite value from internal UUID and the original name). Subfolders are dynamically created in the output directory (.OutputFolder), which are given the name of the input batch, supplemented by its internal database key.