Passing commands to embedded reports

image_pdfimage_print

Jedox reports can be embedded in external web applications. It is also possible for the external web application to set values for @variables in the Jedox report.
For this, you can either append parameters to the report’s URL or use the postMessage Web API in JavaScript code.

URL with passing variables

To find the URL of a report on a server, right-click on a report (user preview), select Properties, and open the Link tab. If this report has the variables  “year”,  “region”, and “product”, and all of them are not private, then you can pass variables with the URL as follows: <URL>&var/year=2009&var/region=West&var/product=Monitors

Example:

<URL>/ui/studio/user=paloinsider&pass=S8CqA&var/year=2009&var/region=West&var/product=Monitors

Calling commands from external sources

You can call commands from external sources such as pages where a Jedox Report is embedded, into Jedox Web. This can be done using the postMessage API. With this option you can, for example, allow setting a specific @variable to a specific value using JavaScript in an external environment. The advantage of using this method is that, instead of reloading the full report in the iframe, it only refreshes the data.

Note: For security reasons, restrict the postmessages to be only accepted from specific, trusted origin environments.

You can enable using the postMessage API through a boolean key in Jedox Web Settings. When set to true, it allows sending a postMessage from JavaScript towards a container with a Jedox Report. To enable it, go to Jedox Web > Administration > Settings and click Add key. Add the following values:

spreadhseet.postmessage.enabled Boolean. Allows sending a postMessage to a container with a Jedox Report.

spreadsheet.postmessage.origins

String. A comma-separated list of allowed origin URLs for postmessage commands.

 Example:

<iframe id="jedox" width="80%" height="80%" src=https://to.mydomain.com/ui/lnk/?_=eJxNkD9vg0AMxb8K8oxg6cScpZUitcrKc...>

document.getElementById('jedox').contentWindow.postMessage( [ ['svar', 'Year', 2018] ], 'from.mydomain.com');

This sample script, running on a page on from.mydomain.com, would set the value of the session variable Year to 2018 (send postMessage to an element with the ID “jedox”).

image_pdfimage_print