biExport Widget Features: Separate Files and Iteration specific Settings
We have added new features to the biExport Widget scripting APIs which enable new scenarios and can improve performance.
To enable these new features we had to make some breaking changes to the addURLParameters API.
addURLParameters now accepts four parameters:
- parameters: Name-Value pairs which are used as URL parameters.
- storyId: The story/application id to be used in this iteration. Before this was an array, now it is just a single string.
- separateFileId: New parameter which enables separate files and specifies to which file this iteration is contributing to. You can choose your own identifier, only make sure to use the same for every iteration which should contribute to the same file. Can be left empty "" when only a single file should be generated.
- settings: New parameter which can be used to define iteration specific settings. Can be left empty [] when unused.
Separate files
biExport always could create multiple files for one export. This is now also possible via the SAC biExport Widget scripting API.
The following example exports each product into a separate file. The filename is the product name.
var products = ["Product 1", "Product 2", "Product 3"];
biExport_1.addExportApplication("B39A6C0614447FFBDEA1E1B217EE279C");
for (var i = 0; i < products.length; i++) {
var product = products[i];
biExport_1.addURLParameters(
[{name: "TEXT", value: product}], /* URL parameters */
"B39A6C0614447FFBDEA1E1B217EE279C", /* Story ID, should match one of the addExportApplication values */
i.toString(), /* File Group ID, different for each product so each iteration produces a different file */
[] /* Iteration specific Settings */
);
}
biExport_1.setDocTemplate("Product.docx");
biExport_1.setFilename("%TEXT%"); /* Filename using the product name from the URL parameters */
biExport_1.doExport("DOCX");
Iteration specific Settings
Different iteration might need different setting, e.g. different screen sizes or waittimes. These can now be configured like this:
- Story page 1 will be loaded with a resolution of 1200x600 and the waittime is set to 1 second.
- Story page 2 will be loaded with a resolution of 1920x1080 and the waittime is set to 5 seconds.
- Story page 3 will be loaded with a resolution of 2000x1200 and the waittime is set to 10 seconds.
biExport_1.addExportApplication("B39A6C0614447FFBDEA1E1B217EE279C");
biExport_1.addURLParameters(
[{name: "page", value: "1"}], /* URL parameters */
"B39A6C0614447FFBDEA1E1B217EE279C", /* Story ID, should match one of the addExportApplication values */
"", /* File Group ID, unused so all iterations contribute to the same file */
[{name: "scroll_width", value: "1200"}, {name: "scroll_height", value: "600"}, {name: "server_waittime", value: "1000"}] /* Iteration specific Settings */
);
biExport_1.addURLParameters(
[{name: "page", value: "2"}], /* URL parameters */
"B39A6C0614447FFBDEA1E1B217EE279C", /* Story ID, should match one of the addExportApplication values */
"", /* File Group ID, unused so all iterations contribute to the same file */
[{name: "scroll_width", value: "1920"}, {name: "scroll_height", value: "1080"}, {name: "server_waittime", value: "5000"}] /* Iteration specific Settings */
);
biExport_1.addURLParameters(
[{name: "page", value: "3"}], /* URL parameters */
"B39A6C0614447FFBDEA1E1B217EE279C", /* Story ID, should match one of the addExportApplication values */
"", /* File Group ID, unused so all iterations contribute to the same file */
[{name: "scroll_width", value: "2000"}, {name: "scroll_height", value: "1200"}, {name: "server_waittime", value: "10000"}] /* Iteration specific Settings */
);
biExport_1.setDocTemplate("Test.docx");
biExport_1.doExport("DOCX");