Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

Output System "StackOrg"

Notice

The "StackOrg" output system can only be used in conjunction with a Stack Organizer that is active in the same scenario.

This output system restructures the content of the current output batch such that it corresponds to the specifications that a user has defined in the Stack Organizer.

The restructured batch is transferred to another scenario for further processing. The restructuring is only temporary. The original batch will remain unchanged. If an additional output step follows, it will refer to the documents in the original batch.

The "StackOrg" output system works in a batch-oriented manner, as the Stack Organizer processes complete batches and these batches are transferred to the further processing scenario as a coherent unit. However, as output systems are always called per document, in this case the entire batch is output when the first document is called. The calls of the other documents have no function. This procedure is only possible because the way the Stack Organizer works ensures that the complete batch is available. With regular processing, however, it is possible that not all documents in the batch are available for output.

Property

Description

OutputSystem[].OutputMode

Mode in which the batch is output:

  • Internal: This mode is comparable to the output system "Internal".

    In this mode, the same general conditions apply as for the "Internal" output system. This includes, for example, the fact that an "Internal" input system is required in the same program instance of an active target scenario to receive the data (default value).

  • InternalJson: the restructured batch is completely re-read via an input system.

    This mode is a combination of the "InternalJson" output format and the "File" output system. The mode generates one output file per document in internal JSON format and outputs it to the file system. File attachments are output in a fixed manner. They are always generated as separate file references and written to the same directory as the primary JSON file.

    An input system of type "File" or "Folder" is required for reading generated output data in the target scenario, so that the primary JSON files are selected first. For the purposes of adding the referenced file attachments, the input format "InternalJson" is also required.

The general property OutputSystem[].FileFilter can be used in both modes. This property can be used to select the file attachments that are transferred to the restructured output batch. Note that, in Internal mode, the filter expression must also include the internally generated JSON file with the index data.

OutputSystem[].DestinationMacro*

Field macro expression for creating the output target of the restructured batch

In Direct mode, the name of the target scenario to which the batch is to be assigned is required as the result value. In InternalJson mode, the folder path to which the batch is to be output is required.

As an additional function, this configuration property can be used to split the output batch into multiple sub-batches with different targets. The macro printout is evaluated for each document in the batch, allowing for differing target values. Documents with the same target value are aggregated into a sub-batch.

OutputSystem[].FileNameMacro

Macro expression that returns the name of the JSON file

The JSON file is generated as the primary output file in InternalJson mode and as an artificially supplemented file attachment in Internal mode.

In InternalJson mode, the file name can also be preceded by a relative folder path that refers to the batch-related folder defined via .DestinationMacro. This allows additional subfolders to be created for each document in the batch folder.

Default value: document.json

OutputSystem[].AttachFileRefMacro

Macro expression that returns the name of each file attachment to be output to the file system

This property only applies to InternalJson mode.

This macro is evaluated separately for each file attachment; therefore, it should use the individual properties of the attachment in the form of file variables to generate unique file names.

Default value: "%FileName%"

Example of the "InternalJson" mode

The following example provides an excerpt of the relevant configuration properties in InternalJson mode:

The original scenario with the active Stack Organizer writes the output data to separate folders by batch. In .DestinationMacro, the UUID of a batch is used to ensure uniqueness in folder names. The name of the JSON output file in the .FileNameMacro also contains a relative folder path to create separate subfolders for each document. The sequential number of the document in the batch is used to ensure uniqueness in folder names. The names of the file attachments in the .AttachFileRefMacro are given a number (of the attachment within the document) to avoid ambiguity in file names.

"Process": {
   "StackOrg": {
      "Activate": true
   }
},
"OutputSystem": {
   "Type":
   "StackOrg",
   "OutputMode": "InternalJson",
   "DestinationMacro": "'c:/test/{%BatchUuid%} %BatchName%'",
   "FileNameMacro": "'[%DocNo%] @DocName/internal.json'",
   "AttachFileRefMacro": "'[%FileNo%] %FileName%'"
}

The data in the target scenario is read in via the "Folder" input system. This allows batch and document folder structure created during output to be read in again in such a way that the original assignment of documents to batches is retained. The alternative "File" input system, on the other hand, can only read the data as independent individual documents, and does not retain the superordinate batch structure.

The .FileFilter ensures that only the JSON file is initially read as the primary file attachment of a document. The other attachments are added later using the "InternalJson" input format based on the references in the JSON file. This allows those original names of file attachments to be restored which are stored as metadata in the JSON file.

"InputSystem": {
   "Type": "Folder",
   "Mode": "SubDocs",
   "RootFolder": "c:/test",
   "FileFilter": "internal.json"
},
"InputFormat": [
   {
      "Type": "InternalJson"
   }
],
"ProcessReadIndex": [
   {
      "Type": "InternalJson"
   }
]