Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to get Server Name
sgummuluru
I need to get Server Name. Our Volume and Server names are different. I use the following for Volume.
Is there a function call for Server Name? Thanks for the help!
myMap = reportContext.getAppContext();
gReportUser = myMap.get("ServerUserName");
gServerName = myMap.get("VolumeName");
Find more posts tagged with
Comments
mwilliams
Could you pass the server name in through a parameter?
sgummuluru
No. This is a scheduled job, doesn't have any parameters. Can't have any hard coding in the report. Reports have to work seamlessly across the environments.
Thank you!
mwilliams
Try this:
reportContext.getHttpServletRequest().getServerName();
sgummuluru
Thank you for the replay...
Says, I can't call the method. No errors on BRD Pro, as not looking at the context. On server get the error.
srvr = reportContext.getHttpServletRequest().getServerName();
":
TypeError: Cannot call method "getServerName" of null (/report/method[
@name="
;initialize"]#3)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:158)
at org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleInitialize(ReportScriptExecutor.java:53)
at org.eclipse.birt.report.engine.api.impl.EngineTask.loadDesign(EngineTask.java:1774)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:216)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:85)
at com.actuate.reportapi.engine.birt.ReportGenerationTask.runTask(Unknown Source)
at com.actuate.reportapi.engine.birt.ReportGenerationTask.generateReport(Unknown Source)
at com.actuate.reportapi.engine.ReportGenerationTaskBase.doTask(Unknown Source)
at com.actuate.reportapi.engine.Task.execute(Unknown Source)
at com.actuate.reportapi.enginemanager.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "//
johnw
Couldn't you use the reportContext.getAppContext.get("ServerURL") call to do this?
sgummuluru
This works like charm !! Thank you John !!!
MarkW
<blockquote class='ipsBlockquote' data-author="'johnw'" data-cid="79355" data-time="1309395808" data-date="29 June 2011 - 06:03 PM"><p>
Couldn't you use the reportContext.getAppContext.get("ServerURL") call to do this?<br /></p></blockquote>
<br />
<br />
I am trying to use this and it keeps coming back null. I am in a DataSource beforeOpen script function.<br />
<br />
<strong class='bbc'>var xml_url = '
http://'+reportContext.getAppContext().get("ServerURL")+'/';</strong><br
/>
<br />
I have also tried reportContext.getAppContext().get("SERVER_URL")<br />
<br />
<br />
This keeps showing <a class='bbc_url' href='
http://null/.'>http://null/.</a>
; How do I get list of all AppContext IDs.....
mwilliams
You can see the keys in the AppContext map by putting this into a dynamic text box in your report.
reportContext.getAppContext().keySet().toArray().join("
");
And with this one, you can see the values.
reportContext.getAppContext().values().toArray().join("
");
If you're not using BIRT Designer Pro, you should be able to use reportContext.getHttpServletRequest().getServerName(); to get the server name.
MarkW
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="107525" data-time="1343197075" data-date="24 July 2012 - 11:17 PM"><p>
You can see the keys in the AppContext map by putting this into a dynamic text box in your report.<br />
<br />
reportContext.getAppContext().keySet().toArray().join("
");<br />
<br />
And with this one, you can see the values.<br />
<br />
reportContext.getAppContext().values().toArray().join("
");<br />
<br />
If you're not using BIRT Designer Pro, you should be able to use reportContext.getHttpServletRequest().getServerName(); to get the server name.<br /></p></blockquote>
<br />
<br />
Thanks, this worked for me..
DenisG
<blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="107525" data-time="1343197075">
<div>
<p>You can see the keys in the AppContext map by putting this into a dynamic text box in your report. reportContext.getAppContext().keySet().toArray().join("
"); And with this one, you can see the values. reportContext.getAppContext().values().toArray().join("
"); If you're not using BIRT Designer Pro, you should be able to use reportContext.getHttpServletRequest().getServerName(); to get the server name.</p>
</div>
</blockquote>
<p>Hello, does exist some way to pass username which logined to OpenText to BIRT report? When I'm using this (reportContext.getAppContext().get("ServerUserName") ) in dynamic text element than I see nothing in report..</p>
Clement Wong
<p>What version of the commercial designer and iHub are you using? The username via <em>reportContext.getAppContext().get("ServerUserName");</em> is returned for me in a Dynamic Text Report Item when run from the iHub.</p>
<p> </p>
<p>Note, if you run from the Designer, since there is no username context, but you should still see "anonymous" as the output. Also, if you're using RSSE, you should still see the username.</p>
DenisG
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="140789" data-time="1450726574">
<div>
<p>What version of the commercial designer and iHub are you using? The username via <em>reportContext.getAppContext().get("ServerUserName");</em> is returned for me in a Dynamic Text Report Item when run from the iHub.</p>
<p> </p>
<p>Note, if you run from the Designer, since there is no username context, but you should still see "anonymous" as the output. Also, if you're using RSSE, you should still see the username.</p>
</div>
</blockquote>
<p>Hi, Clement! I'm using non-commercial BIRT 4.5.0 and I'm running my reports via OpenText Content Server 10.5 which installed on TOMCAT. And my aim is to return username which ran report at the bottom of the report.</p>
Clement Wong
<p>Since you are not using the commercial Designer or the iHub, you'll need to review this reply in this older thread written by a collegaue, Pierre Richer @ <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/34430-display-username-that-execute-the-report/#entry127652'>http://developer.actuate.com/community/forum/index.php?/topic/34430-display-username-that-execute-the-report/#entry127652</a></p>
;
Sai krishna
<p>Good morning!!</p>
<p> </p>
<p>What this "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">reportContext.getAppContext().get("ServerUserName</span>") " returns...? Could you please help me. Unable to guess that.</p>
<p> </p>
<p>Thanks in Advance.</p>
<p> </p>
<p>Sai</p>
Clement Wong
<p>If you are using commercial BIRT,<span style="font-family:'courier new', courier, monospace;"> reportContext.getAppContext().get("ServerUserName")</span> will return you the username logged into the iHub/Information Console.</p>