Export Scenario to XCSV

This task exports the contents of the selected scenario to an XCSV archive file (ZIP with CSV).

    @Bean
    public ScriptedTaskDescription xcsvExportTask() {
        ScriptedTaskDescription task = new ScriptedTaskDescription("XCSVExportTask", "Export scenario to XCSV");
        task.setDescription("Export the contents of the selected scenario to a XCSV archive file (ZIP with CSV)");
        setI18nKeys(task, "XCSV_EXPORT");

        task.getScript()

            .addStatement(AskInputStatement.of("scenario", true, JobInputType.SCENARIO_ID))
            .addStatement(AskInputStatement.of("base file name", true, ParameterTypes.TEXT, "Name of the file to export to. Warning: a '.xcsv' extension will be appended."))
            .addStatement(AskInputStatement.of("filter", false, JobInputType.ENTITIES, "Select the tables to export"))

            .addStatement(SetTaskOutputStatement.of("XCSV file",
                FileExpression.of(
                    StringExpression.concat(VariableAccessExpression.of("base file name"), StringExpression.of(".xcsv")),
                    BlobExpression.of(ScenarioDataExpression
                        .of(VariableAccessExpression.of("scenario"))
                        .withFormat(ScenarioDataFormat.XCSV)
                        .onlyTables(VariableAccessExpression.of("filter"))),
                    StringExpression.of("application/octet-stream")
                )));

        return task;
    }