Executing Scripts in Groovy Jobs

Database scripts can be generated and executed in Jedox Integrator with a Groovy job. Examples for the use of script functions and jobs can be found in the sample Jedox Integrator projects sampleGroovyOlap.xml, sampleGroovyFunction.xml, sampleGroovyJob.xml, and ETLTasks.xml.

Task Interface Example
Generating script for a dimension IDimensionScriptContext
Copy
IDimension dim = db.getDimensionByName("Regions");
                                IDimensionScriptContext dsc = dim.getScriptContext();
                                dsc.setComplete(true);
                                dsc.setWithAttribute(true);
                                dsc.setIncludeLocalSubsets(true);
                                dsc.setIncludeGlobalSubsets(true);
                                dsc.setIncludeDimensionRights(true);
                                dsc.setCreateClause(IScriptHandler.ScriptCreateClause.NO_ERROR);
                            String dimScript = dim.generateScript(dsc);
Generating script for a cube ICubeScriptContext
Copy
ICube cube = db.getCubeByName("Sales");
                                ICubeScriptContext csc = cube.getScriptContext();
                                csc.setComplete(true);
                                csc.setWithAttribute(true);
                                csc.setWithRule(true);
                                csc.setIncludeCubeRights(true);
                                csc.setCreateClause(IScriptHandler.ScriptCreateClause.NO_ERROR);
                            String cubeScript = cube.generateScript(csc);
Generating script for a whole database IDatabaseScriptContext
Copy
IDatabaseScriptContext dbsc = db.getScriptContext();
                                dbsc.setCreateClause(IScriptHandler.ScriptCreateClause.NO_ERROR);
                            String databaseScript = db.generateScript(dbsc);
Reading the variables and values of a given script IScriptvariable
Copy
IConnection conn = OLAP.getConnection("olapdemo");
                                LOG.info("variable Name - variable Value - Description:");
                                IScriptvariable[] variables = conn.getScriptHandler().getvariables(dimScript);
                            for (IScriptvariable variable : variables)
Setting the variable values in a given script IScriptvariable
Copy
for (IScriptvariable variable : variables) {
                                if (variable.getName().equals("DimensionName")) {
                                String newName = variable.getValue()+"_Copy";
                                LOG.info("Change dimension name to "+newName);
                                variable.setValue(variable.getValue()+"_Copy");
                                }
                            }
Executing a database script (with a given set of variable values) IScriptHandler
Copy
IScriptHandler scriptHandler = conn.getScriptHandler();
                                IDatabase db = OLAP.getDatabase("olapdemo");
                                IDimension dim = db.getDimensionByName("Regions");
                                IDimensionScriptContext dsc = dim.getScriptContext();
                                String dimScript = dim.generateScript(dsc);
                            scriptHandler.execute(dimScript,"Demo",variables);

Within Integrator Groovy jobs and functions, a Java API (palojlib) – can be used by model builders. The Java API provides all functions necessary for establishing a connection to the In-Memory DB, retrieving data, and creating or modifying database contents.

An overview and documentation of all functions provided in the Jedox Java API can be found in the Java API Documentation, which is available online or as a download.

Updated April 14, 2025