Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » __timezone string corrupted on Drill-through hyperlink
__timezone string corrupted on Drill-through hyperlink [message #1290825] Thu, 10 April 2014 13:20 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
I launch my report with the URL "...&__timezone=GMT%2b08%3a00..." which works for the first report. However when I use a Drill-through hyperlink from that report to another report, the URL shows up as "...&__timezone=GMT+08:00...". In other words the escaped characters %2b and %3a have been translated to + and : respectively. This causes the URL not to be incorrectly processed and the timezone for the second report is wrongly interpreted as just GMT since the + is considered a space.

Unfortunately I have no control over the actual timezone string that will get passed to the initial report, such as using asia/shanghai rather than GMT+08:00.

Can someone please suggest a workaround for this issue?
Re: __timezone string corrupted on Drill-through hyperlink [message #1682073 is a reply to message #1290825] Tue, 17 March 2015 15:33 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Still having this issue. Can some tell me if there is a way to intercept the constructed drill-through URL in a script and modify it before its execution? If so I could just translate the characters back to the proper escape sequences to work around the problem.
Re: __timezone string corrupted on Drill-through hyperlink [message #1682360 is a reply to message #1682073] Tue, 17 March 2015 18:04 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

What is your BIRT version? How is the drill through URL constructed? Just using a parameter value that's entered to pass through the url to the next report? If you could create a simple example that I can run showing your current method, that'd be helpful.

Michael

Developer Evangelist, Silanis
Re: __timezone string corrupted on Drill-through hyperlink [message #1682411 is a reply to message #1682360] Tue, 17 March 2015 18:26 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
I'm on Birt Version 4.2.2.v201210101433

The URL passed to the main report is
...&GCUnit=0&__locale=en_GB&__svg=false&__designer=false&__pageoverflow=0&__masterpage=true&Start+Time=2015-03-13+09%3A13%3A19.764&End+Time=2015-03-13+11%3A14%3A20.064&__timezone=GMT%2b05%3A00&TimeZone=GMT%2b05%3A00

The drill through report URL comes out as:
...&Debug=false&hasTargetStats=true&applyThreads=1&Time+Buckets=10&GCUnit=0&Subscription=H246_TER&Start+Time=2015-03-13+09%3A13%3A19.764&hasSourceStats=false&RacNodes=1&__locale=en_GB&__timezone=GMT+05:00&__designer=false

I am just using the GUI to create a hyperlink on a label as seen in the image hyper.png.

As you can see in the second URL the __timezone does not have escaped characters and thus the "+" is considered a space and the timezone value is incorrect.
  • Attachment: hyper.png
    (Size: 37.05KB, Downloaded 114 times)

[Updated on: Tue, 17 March 2015 18:35]

Report message to a moderator

Re: __timezone string corrupted on Drill-through hyperlink [message #1682525 is a reply to message #1682411] Tue, 17 March 2015 19:27 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

One thing you could do is to build the url on your own in a text box or with the URI hyperlink option vs using the drill through. Another option could be to change the value with client side script. I'll let you know if I see another way to change the value.

Michael

Developer Evangelist, Silanis
Re: __timezone string corrupted on Drill-through hyperlink [message #1682602 is a reply to message #1682525] Tue, 17 March 2015 20:06 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Can you describe in more detail how you could change the __timezone value in a client side script?
I can get the URL query string using
reportContext.getHttpServletRequest().getQueryString();
but after replacing GMT+ with GMT%2b how do you set the query string. I don't see an API for that. Furthermore, at what point is the __timezone parameter captured by BIRT. If I do change it will it be too late?

Re: __timezone string corrupted on Drill-through hyperlink [message #1682698 is a reply to message #1682602] Tue, 17 March 2015 20:58 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Client side could be something like this if you bookmark your link element with "mylink":

<script>
oldLink = document.getElementById("mylink").innerHTML;
newLink = oldLink.replace("GMT+05:00","GMT%2b05%3A00");
document.getElementById("mylink").innerHTML = newLink;
</script>


That works.

If you're wanting to modify the drill down report, you could always set the rawOffset of reportContext.getTimeZone(). You'd just need to compute that value based on the offset in milliseconds (remembering daylight savings time).


Michael

Developer Evangelist, Silanis
Re: __timezone string corrupted on Drill-through hyperlink [message #1684487 is a reply to message #1682698] Wed, 18 March 2015 12:51 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
That script looks promising.
1) Where would I put it? Would the initialize script of the report work?
2) I don't understand the "if you bookmark your link element with "mylink". How does one do that?
Re: __timezone string corrupted on Drill-through hyperlink [message #1684700 is a reply to message #1684487] Wed, 18 March 2015 14:42 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

The script in the post above would have to go in a text element with HTML selected from the drop down at the top of the editor. The label or element that your drill through was on would have to be bookmarked with "mylink". This would be done by selecting the linked element in your report, going to the bookmark section of the property editor, and adding that as the bookmark expression.

This will only work if your main report is in HTML format. Let me know if you need a sample report.


Michael

Developer Evangelist, Silanis
Re: __timezone string corrupted on Drill-through hyperlink [message #1684842 is a reply to message #1684700] Wed, 18 March 2015 15:52 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Thanks, I'm getting really close now. The script you proposed would do the trick, however I have a lot of links to drill through reports. I already have a script that I use to modify the look & feel of the links generically
<script type="text/javascript">
function doAll(){
var anchors = document.getElementsByTagName('A');
for (ii=0;ii<anchors.length;ii++) {
if (anchors[ii].parentNode.id.indexOf("toc") != -1) {
anchors[ii].style.textDecoration="none";
}
}
}

doAll();
</script>

So I am trying to just add code to this script that will also fix up any "GMT+" issues
<script type="text/javascript">
function doAll(){
var anchors = document.getElementsByTagName('A');
for (ii=0;ii<anchors.length;ii++) {
oldLink = anchors[ii].innerHTML;
newLink = oldLink.replace("GMT+","GMT%2b");
anchors[ii].innerHTML = newLink;

if (anchors[ii].parentNode.id.indexOf("toc") != -1) {
anchors[ii].style.textDecoration="none";
}
}
}

doAll();
</script>

But this didn't work. I assume that the element that anchors is pointing to is not the same type of element that is retrieved by
document.getElementById("toc_RawStats").innerHTML

Could I get a little help in tweaking the above code such that it will run through all the links and perform the required substitution? That would be awesome.
Re: __timezone string corrupted on Drill-through hyperlink [message #1684899 is a reply to message #1684842] Wed, 18 March 2015 16:24 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Actually, I figured it out. The corrected script is

<script type="text/javascript">
function doAll(){
var anchors = document.getElementsByTagName('A');
for (ii=0;ii<anchors.length;ii++) {
oldLink = anchors[ii].parentNode.innerHTML;
newLink = oldLink.replace("GMT+","GMT%2b");
anchors[ii].parentNode.innerHTML = newLink;
if (anchors[ii].parentNode.id.indexOf("toc") != -1) {
anchors[ii].style.textDecoration="none";
}
}
}

doAll();
</script>

Thank you for all your help.
Re: __timezone string corrupted on Drill-through hyperlink [message #1687511 is a reply to message #1684899] Thu, 19 March 2015 17:39 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Not a problem. Glad you got it working! Smile

Michael

Developer Evangelist, Silanis
Re: __timezone string corrupted on Drill-through hyperlink [message #1687512 is a reply to message #1684899] Thu, 19 March 2015 17:39 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Not a problem. Glad you got it working! Smile

Michael

Developer Evangelist, Silanis
Previous Topic:Birt 2 -> Birt 4.4.2
Next Topic:Page break
Goto Forum:
  


Current Time: Thu Jul 25 01:43:16 GMT 2024

Powered by FUDForum. Page generated in 0.04709 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top