Export Scenario to ZIP
This task exports the contents of the selected scenario to a ZIP archive, in CSV format.
@Bean public ScriptedTaskDescription zipExportTask() { ScriptedTaskDescription task = new ScriptedTaskDescription("ZipExportTask", "Export scenario to ZIP"); task.setDescription("Export the contents of the selected scenario to a ZIP archive, in CSV format"); setI18nKeys(task, "ZIP_EXPORT"); var scenario = VariableAccessExpression.ofScenario(); var baseFileName = VariableAccessExpression.of("base file name"); var filter = VariableAccessExpression.ofFilter(); task.getScript() .addStatement(AskInputStatement.ofVariable(scenario, true, JobInputType.SCENARIO_ID)) .addStatement(AskInputStatement.ofVariable(baseFileName, true, ParameterTypes.TEXT, "Name of the file to export to. Warning: a '.zip' extension will be appended.")) .addStatement(AskInputStatement.ofVariable(filter, false, JobInputType.ENTITIES, "Select the tables to export")) .addStatement(SetTaskOutputStatement.of("ZIP file", FileExpression.of( StringExpression.concat(baseFileName, StringExpression.of(".zip")), BlobExpression.of(ScenarioDataExpression.of(scenario).onlyTables(filter).withFormat(CSV)), StringExpression.of("application/octet-stream") ))); return task; }