Export - FAQ
This article is based on frequently asked questions about export issues. It attempts to provide clear explanations, and to offer workable solutions.
Why is my assortment variable not visible in data sources of export?
The problem
You want to use a variable to specify the item assortment of an item data provider, but the variable is not in the list of available item assortments.
You've defined the variable correctly...
... but it is not shown in the item assortment list
The solution
An item assortment variable is independent of an item catalog. That's why there are no item assortment variables available if you've specified the catalog for a data source.
If you choose "<dynamic>" as catalog parameter value you get the item assortment variable displayed in the list.
How can I differentiate my output file?
The problem
Usually the output file of an export will get the same name as the export template. But you need to differentiate the output file between each export.
You've defined a delta export with some variables which you would like to have in your output file.
The solution
You can define the generated file pattern in each export format template. Therefore you need to go to the "File management" tab where you can see the default output file and extended options. To be able to use variables in your output file you need to enable the "Extended options" and create a new file. Next, you need to click on the button in order to define a pattern:
In this popup menu you use your variables and function in order to define your output file name pattern.
After defining the pattern you need to add your created file as "Export file" in each module and submodule of your export format template.
Is it possible to disable or remove the 'Generate Preview' function in Desktop client?
Yes, it is.
With the "Export Purpose" attribute of repository root entities you can configure the behavior of the export context menu, see Customizing - Server and Platform - Domain Model (Repository).
If you want to disable the "Generate preview" functionality for items, you have to adjust the corresponding export purpose value of the "Article" root entity in repository: change it from "15" (export (1) + preview (2) + supplier portal (4) + immediate export (8)) to 13 (export (1) + supplier portal (4) + immediate export (8))
How can I implement conditional output of file attachments?
The problem
You have a simple condition in top module (item list level) so that only few items pass through. In a sub-module you want to export all file attachments of the "good" items using the ExportMime export function for exporting images. The file attachments of all items that don't meet the condition are expected to not be exported.
But the resulting image zip export file contains images of all items.
Explanation
Similar to function calls (see Export functions) it is not possible to have conditional sub module calls. Each sub module call is executed during an export. The only thing you can do is to hide the output of a sub module into the corresponding export file.
The solution
You can check the condition in the calling top module and save the result to a variable using the ValueSet export function. The sub-module can use that variable value by ValueGet and prepare the corresponding function call.
In the example, an empty document identifier is passed to the ExportMime function in case the condition is not fulfilled.
How can I make the export fail if the command executed in post-step reports errors?
The problem
You have an export post-step that executes a command file. That command file handles errors. You want your export to be cancelled if an error occurred during the command execution.
With default values of the "Execute command file" export post step and a common command file the export will be finished successfully even if the command could not be executed successfully.
The solution
First you have to redirect the error message to the stderr in your command file, e.g.
@
echo
off
:: Writes a message to stdout
echo
Hi, this is the good message
:: Writes a message to stderr
echo
Hi, this is the bad message 1>&2
Second, you have to configure the export post-step:
Set "Log output" to "only errors" or "all" to get messages of the command written into the export log
Set "Cancel export in case of error" to "Yes" to get the export job cancelled if an error is reported by the command
Each error or each message written by your command will be added to the export protocol:
Can I run multiple exports of the same assortment at the same time?
Yes, if...
... the exports don't update the assortment.
No, if...
... the exports update the assortment.
Explanation
If an assortment is updated by multiple export jobs at the same time the export result is unpredictable: when assortment data is read while being modified by another instance, an intermediate state could be read.
But if I need to update the assortment?
Either..
.. run the first export which updates the assortment and schedule the other exports which don't update the assortment to run some minutes later
or...
... use different assortments for the exports. But be careful, maybe this approach could cause performance issues if the assortments are complex or big.