Report Viewer
The inmation:reportviewer is online Report display application. Report viewer allows Report preview outside and inside of the DataStudio. Other functionality includes saving reports locally and printing them.
Access Report Viewer
There are two ways to open a Report:
Report viewer can be accessed through the App Launcher using the base address of the Web API host. For example:
Select reportviewer, select launch options and click on open. First connection dialog will popup and after successful signin another dialog will popup asking for the object path of the Report Item.
Alternatively, you can pass the report object path directly in the URL: http(s)://baseaddress/static/reportviewer/?path=fullreportpath
Launching
Report Viewer can be accessed via the following URL links:
Description | URL |
---|---|
Base URL |
|
Report view |
http://<hostname_webapi>/apps/reportviewer/?path=fullreportpath |
The report viewer can be loaded on screen and passing arguments to the system in order to render the report. In order to receive those arguments, the 'AdvancedLuaScript' of a Report Item should return a function with the three function arguments like of those of execfunction
and Advanced Endpoint. In case you want to pass a complex structure or data to the Report View, you need to serialize it to JSON and encode it to Base64. See Lua snippet.
-- Demo of fetching the report data dynamically.
local JSON = require('rapidjson')
local mime = require('mime')
-- The function arguments will only be provided when the Web Report Viewer fetches the report.
return function(arg, req, hlp)
if type(arg) == 'table' and type(arg.query) == 'table' then
-- Do some permission check over here!
local result = {}
if type(arg.query.data) == 'string' then
-- Invoked as an Advanced Endpoint.
local queryData = mime.unb64(arg.query.data)
local queryObj = JSON.decode(queryData)
-- queryObj is now a Lua table.
-- Build the reportdata
end
return result -- Can be a Lua table. Since this function is executed by the Web APi.
end
-- Make sure you return data in a JSON string for reports which are displayed in DataStudio.
return [[
-- JSON data structure
]]
end