Accessing Jedox Integrator from PHP
In Jedox Web reports, Integrator jobs can be started via Actions. If you cannot use Actions, you can also start Integrator jobs via Macros. To access Jedox Integrator and, for example, execute Integrator projects from the Macro Engine in Jedox Web Spreadsheets, you can use wrapper functions , which are briefly described below. For details on these and other functions, see Macro Engine Overview.
Integrator jobs can also be triggered with OData. See Jedox OData Hub Overview for more information.
Wrapper functions for accessing Jedox Integrator
To use the wrapper function, the macro code first requires the "integrator" code library. This is done to avoid integration of the code in macros that do not actually use it.
The library is required with this code:
require library('integrator');
integrator_start_job
To execute a specific job, the function "integrator_start_job" can be called. In its simplest form, this function expects the name of a project and the name of a job in that project as parameters:
$id = integrator_start_job('sampleBiker','default');
First, the function will check if the job is already running at the moment. If this is the case, it will exit with a message indicating so. If this is not the case, then the function immediately returns the Job ID of the executed job. Additionally, the function offers a set of optional arguments that allow modifying its behavior.
integrator_set_job
This function retrieves the status of a job (identified by its execution ID), and sets it to some resource in the spreadsheet, such as a cell or an @variable.
// retrieve the job id from its resource (has to be set beforehand)
$id = retrieve_variable('INTEGRATOR_JOB_ID');
// get the status code and message (array) of the job
$status = integrator_set_job_status($id);
The function returns an array with the two fields: "status_code" and "status_message".
integrator_get_last_execution_id
This function retrieves the ID from the last execution matching the provided project / job criteria.
// retrieving the id from the last execution of job "Masterdata" in project "sampleBiker"
$id = integrator_get_last_execution_id($project, $job);
// show the returned execution id a message box
return __msgbox('Last execution has id '.$id,'.');
integrator_get_execution_info
This function gets execution information for the provided execution ID.
// Retrieve information about the finished execution with ID 25
$execInfo = integrator_get_execution_info($execId);
integrator_get_data
This function extracts a specific number of rows of data from an extract or transform for display in a spreadsheet.
function integrator_get_source_data ($project,$source,$variables = array(),$view,$lines,$start,$status_resource = array('type' => 'variable', 'name' => 'INTEGRATOR_JOB_STATUS')
Details on wrapper functions can be found in the overview of the functions and objects exposed to the Macro Engine.
Updated November 21, 2024