You are not logged in.
Pages: 1
Hi Guys,
Is there any way to get a Static Html Dadget through the id and just show it through a url?
Last edited by Guilherme (2017-05-30 14:33:40)
Offline
Hello Guilherme,
Reportserver doesnt provide a url for the dadgets. Dadgets are bound with a Dashboard, and Dashboards with a Container, which the user-Object contains.
So, unfortunately, you cant open separate dadgets in separate windows.
Sure you can run multiple instances of reportserver on different windows. Maybe it putts off a bit.
Best regards,
Rodion
Offline
Hi Guilherme,
this is correct: reportserver doesn't provide urls for dadgets. but we are thinking on the possibility of indirectly calling a html dadget per script, which would be callable per url.
We will update here with more information, stay tuned.
It would also be interesting to know why do you need this, what are you trying to achieve ?
Cheers,
Eduardo
Offline
Hi All,
As long as the dadget is defined in the dadget library, it is possible to get it and display its data via a script report. Then we can call the report via URL.
First we need to create a static HTML dadget in the dadget library. As the dadget ID cannot be obtained from a GUI, we need to use its node ID, which is visible at the top left corner of the dadget definition window.
Then we create a script report with:
- a text parameter of a java.lang.Long type and a key 'dadgetNodeId'. The parameter will pass the dadget node ID value to the script.
- a HTML output format
Then we can call the script report via url, like any other report. The url goes as follows:
http://HOST_IP:PORT/REPORTSERVER_BASE_FOLDER/reportserver/reportexport?id=SCRIPT_REPORT_ID&p_dadgetNodeId=DADGET_NODE_ID&format=HTML&download=false
The script for the script report:
package dadget
import net.datenwerke.rs.core.service.reportmanager.engine.basereports.CompiledHtmlReportImpl
import net.datenwerke.rs.dashboard.service.dashboard.dagets.StaticHtmlDadget
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dadget
import net.datenwerke.rs.dashboard.service.dashboard.entities.DadgetNode
String reportContent
Long dadgetNodeId = (Long) parameterMap["dadgetNodeId"]
DadgetNode dadgetNode = GLOBALS.findEntity(DadgetNode.class, dadgetNodeId)
if (dadgetNode != null){
Dadget dadget = dadgetNode.getDadget()
if (dadget instanceof StaticHtmlDadget){
reportContent = dadget.getData()
} else {
reportContent = ErrorReport.notStaticHtmlDadget()
}
} else {
reportContent = ErrorReport.noDadgetNodeWithGivenId()
}
return new CompiledHtmlReportImpl(reportContent)
public class ErrorReport {
public static String noDadgetNodeWithGivenId(){
return """\
<html>
<head>
<title>Error</title>
</head>
<body>
<p>"Cannot find a dadget - nothing to show"</p>
</body>
</html>
"""
}
public static String notStaticHtmlDadget(){
return """\
<html>
<head>
<title>Error</title>
</head>
<body>
<p>"This is not a HTML dadget - nothing to show"</p>
</body>
</html>
"""
}
}
Comments:
1. The ErrorReport class is optional. If it is not there, users will see an error stack trace or error message in case node id is not found or when the dadget is not a static html dadget. I prefer displaying an error report.
2. The solution will work in ReportServer Enterprise Edition only
Hope it helps.
Karolina
Offline
Hi All,
As long as the dadget is defined in the dadget library, it is possible to get it and display its data via a script report. Then we can call the report via URL.
First we need to create a static HTML dadget in the dadget library. As the dadget ID cannot be obtained from a GUI, we need to use its node ID, which is visible at the top left corner of the dadget definition window.
Then we create a script report with:
- a text parameter of a java.lang.Long type and a key 'dadgetNodeId'. The parameter will pass the dadget node ID value to the script.
- a HTML output formatThen we can call the script report via url, like any other report. The url goes as follows:
http://HOST_IP:PORT/REPORTSERVER_BASE_FOLDER/reportserver/reportexport?id=SCRIPT_REPORT_ID&p_dadgetNodeId=DADGET_NODE_ID&format=HTML&download=false
The script for the script report:
package dadget import net.datenwerke.rs.core.service.reportmanager.engine.basereports.CompiledHtmlReportImpl import net.datenwerke.rs.dashboard.service.dashboard.dagets.StaticHtmlDadget import net.datenwerke.rs.dashboard.service.dashboard.entities.Dadget import net.datenwerke.rs.dashboard.service.dashboard.entities.DadgetNode String reportContent Long dadgetNodeId = (Long) parameterMap["dadgetNodeId"] DadgetNode dadgetNode = GLOBALS.findEntity(DadgetNode.class, dadgetNodeId) if (dadgetNode != null){ Dadget dadget = dadgetNode.getDadget() if (dadget instanceof StaticHtmlDadget){ reportContent = dadget.getData() } else { reportContent = ErrorReport.notStaticHtmlDadget() } } else { reportContent = ErrorReport.noDadgetNodeWithGivenId() } return new CompiledHtmlReportImpl(reportContent) public class ErrorReport { public static String noDadgetNodeWithGivenId(){ return """\ <html> <head> <title>Error</title> </head> <body> <p>"Cannot find a dadget - nothing to show"</p> </body> </html> """ } public static String notStaticHtmlDadget(){ return """\ <html> <head> <title>Error</title> </head> <body> <p>"This is not a HTML dadget - nothing to show"</p> </body> </html> """ } }
Comments:
1. The ErrorReport class is optional. If it is not there, users will see an error stack trace or error message in case node id is not found or when the dadget is not a static html dadget. I prefer displaying an error report.
2. The solution will work in ReportServer Enterprise Edition onlyHope it helps.
Karolina
Thank you Karolina i'll test.
Offline
Pages: 1