Similar to reports, dashboards can be created or run directly from your application. JDashboard uses /{context_root}/dashboard/app/entry/run.jsp
as the URL entry. Here {context_root} is the servlet's context root when deployed in a WAR or EAR file as a servlet.
To create a new dashboard from URL, simply use /{context_root}/dashboard/app/entry/run.jsp
.
For example, run the URL http://localhost:8888/dashboard/app/entry/run.jsp
, and JDashboard will be opened with a new blank dashboard in it. You can then begin to build your dashboards.
After JDashboard has been set as the server user console home page, you can use a URL to access the home page.
Parameter name: jrd_lastsession
Parameter value: true/false
Examples:
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_lastsession=true
http://<IP>:<port>/jreport/dashboard/app/entry/run.jsp?jrd_lastsession=true
, here jreport is the servlet context root.JReport provides parameters for developer users to run dashboards via URLs. Some parameters are encapsulated as JSON (JavaScript Object Notation) objects. Therefore, it will help if you obtain some knowledge on JSON to understand the syntax more clearly. When composing the URL, you need to use URL encoding to avoid errors. To encode URLs by JavaScript, the function encodeURI is recommended.
{name:"ServerResourceTreePath/Dashboard1.dsh", // The dashboard file name with its path in the server resource tree, either in the My Reports folder (/USERFOLDERPATH/admin/) or in the Public Reports folder (/).
ver:-1, // Optional: The version number of the dashboard. -1 means the latest version.
dsh_params:[
// Specify the parameter values used in the dashboard.{lc_names:["lc1","lc2",...], // Optional: lc1 and lc2 can be either of the following:
- The names of the library components in the dashboard, with full path in the server resource tree, either in the My Components folder (/USERFOLDERPATH/admin/) or in the Public Components folder (/COMPONENT_LIB/). For example, /COMPONENT_LIB/SampleReports/Sales Bar.lc.
- The IDs of the library components. The ID of a library component can be known in the library component's About panel. To access the panel, click
on the component's title bar and select About from the drop-down list.
jrd_params:{parameter1:"value1",parameter2:["value1","value2",...]} // If lc_names and jrd_params are specified together, the parameters here are applied to the library components given by lc_names, otherwise to the dashboard. When both dashboard level and library component level parameters exist in the URL, the order to apply parameters will be: the dashboard first, and then the library components. When several library components are the same in the dashboard, the parameters specified to one of them will also work on the others.
}
]
,
... // Specify more dashboards following the above format.
]
}
Examples:
http://<IP>:<port>/jreport/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",ver:-1}]}
, here jreport is the servlet context root.http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:1,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 2.dsh"},{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh"}]}
In this case, after JDashboard is displayed, Dashboard 2.dsh and Dashboard 1.dsh are open and follow the order from left to right, and Dashboard 1.dsh is active by default.
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:1,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 2.dsh"},{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh"}]}&jrd_dashboard_mode=view
The only difference between this example and the second one above is that this URL runs JDashboard in the view mode while the above example runs JDashboard in the edit mode.
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",dsh_params:[{jrd_params:{P_StartDate:"01/01/2006",P_EndDate:"12/31/2007"}}]}]}
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",dsh_params:[{lc_names:["/COMPONENT_LIB/SampleReports/Country Sales by Category.lc","/COMPONENT_LIB/SampleReports/Sales Bar.lc"],jrd_params:{P_StartDate:"01/01/2006",P_EndDate:"12/31/2007"}}]}]}
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",dsh_params:[{jrd_params:{P_StartDate:"01/01/2006",P_EndDate:"12/31/2007"}},{lc_names:["/COMPONENT_LIB/SampleReports/Country Sales by Category.lc","/COMPONENT_LIB/SampleReports/Sales Bar.lc"],jrd_params:{P_StartDate:"01/01/2006",P_EndDate:"12/31/2007"}}]}]}
Add a property in jrd_resext:
// Specifies the data sources for switching the dashboard and/or the specific library components in the dashboard to.
{
lc_names:["lc1","lc2",...], // Optional.
jrd_datasources:[{datasource1},{datasource2},...] // If lc_names and jrd_datasources are specified together, the data sources here are applied to the library components given by lc_names, otherwise to the dashboard. When both dashboard level and library component level data sources exist in the URL, the order to apply data sources will be: the dashboard first, and then the library components. When several library components are the same in the dashboard, the data source specified to one of them will also work on the others. The property "ds" is optional. If "ds" is not specified, the new connection here applies to all involved data sources. If "ds" is specified, the new connection appliesonly
to the same data source as that specified by "ds".}
]
Example:
http://localhost:8888/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",dsh_datasources:[{jrd_datasources:[{"ds":"Data Source 1","uid":"test","pwd":"1234","type":"0","url":"jdbc:oracle:thin:@127.0.0.1:1521:ora8i","driver":"oracle.jdbc.driver.OracleDriver"}]},{lc_names:["/COMPONENT_LIB/SampleReports/Country Sales by Category.lc","/COMPONENT_LIB/SampleReports/Sales Bar.lc"],jrd_datasources:[{"ds":"Data Source 1","uid":"test","pwd":"1234","type":"0", "url":"jdbc:oracle:thin:@127.0.0.1:1521:ora8i","driver":"oracle.jdbc.driver.OracleDriver"}]}]}]}
jrs.authorization, jrs.auth_uid and jrs.auth_pwd are supported.
Example for jrs.authorization:
http://<IP>:<port>/jreport/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",ver:-1}]}&jrs.authorization=YWRtaW46YWRtaW4%3D
Example for jrs.auth_uid and jrs.auth_pwd:
http://<IP>:<port>/jreport/dashboard/app/entry/run.jsp?jrd_resext={active:0,reslst:[{name:"/USERFOLDERPATH/admin/Dashboard 1.dsh",ver:-1}]}&jrs.auth_uid=admin&jrs.auth_pwd=admin