jo_atman Posted October 14, 2006 Share Posted October 14, 2006 Friends,I have scoured the discussion for hyperlink-related questions, but didn't find what i was looking for, so here goes:i'm using hyperlinks between subreports within one master report.So, in subreport1, i have:<textField ... hyperlinkType="LocalAnchor"> ... <hyperlinkAnchorExpression> expr (a fill-time evaluated expression) </hyperlinkAnchorExpression></textField> and in subreport2:<textField> ... <anchorNameExpression> expr (the same fill-time evaluated expression) </anchorNameExpression></textField> The questions are:1. is "LocalAnchor" ok for linking between subreports within the same report? 2. are the links evaluated at compile time or fill-time? because my expressions are $F{} fields evaluated at fill-time Currently, the symptom is that clicking on my hyperlink doesn't do anything. when i debug with source code, it says that the hyperlink has null hyperlinkAnchor, so i'm not sure why the anchor didn't get set. Any help is as always greatly appreciated.Thanks,Nilesh Link to comment Share on other sites More sharing options...
jo_atman Posted October 16, 2006 Author Share Posted October 16, 2006 At this point, the only conclusion i can draw is that dynamic (resolved during fill-time) hyperlinks are not possible. I noticed that in the <hyperlinkAnchorExpression> as well as the <anchorNameExpression>, if the CDATA was enclosed in quotes, it was used. if not, it was ignored. Now if it's in quotes, it assumes that it's a string constant expression, not something to be evaluated.I'm surprised that no one has felt the need for something of this sort. here's my business case:in one subreport, i have a list of user-defined city groups shown. for e.g. CityGroup1 <-- this needs to be an anchorLAX/SFO/OAK further down, in another subreport (for that matter, it could be in the same subreport), there's a table that has the citygroup listed in one of the columnse.g.From To FareCityGroup1 HKG $1200 Here, CityGroup1 needs to be a hyperlink that takes me back to the definition of the subreport.The way i tried to accomplish this is as follows:1. Add an <anchorNameExpression> <![CDATA[$F{groupCode}]]> </anchorNameExpression> up where the anchor is. 2. created a map in my code, which contains hyperLinkMap.put( groupCode, groupCode ); 3. and at the place where the hyperlink needs to be, i have <hyperlinkAnchorExpression> <![CDATA[$P{hyperlinkMap.get($F{groupCode})]]> </hyperlinkAnchorExpression> of course, with the reportElement stating that it's a "LocalAnchor". Anyone have any ideas/suggestions?Thanks,Nilesh </hyperlinkAnchorExpression> is to create a hyperlink map in my code, that says Link to comment Share on other sites More sharing options...
lucianc Posted October 16, 2006 Share Posted October 16, 2006 How did you come to that conclusion? Anchor expressions are evaluated just like any other expressions. You can see this in the "hyperlink" and "tableofcontents" samples distributed with JR. Do you have a simple and replicable example of an "ignored" anchor expression? Regards,Lucian Link to comment Share on other sites More sharing options...
jo_atman Posted October 17, 2006 Author Share Posted October 17, 2006 Lucian,Thanks for the reply.I'm attaching a simple report that i'm having problems with. my strategy is this:create a hyperlink map that gets passed in as a parameter. the hyperlink map will contain the hyperlink anchornames and are used by the hyperlink anchor expression.i have attached a zip file containing a jrxml, and a java file. i'm sure i'm doing something stupid, but i need someone else to look at it and tell me what :) [file name=hyperlink.zip size=1816]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/hyperlink.zip[/file] Link to comment Share on other sites More sharing options...
jo_atman Posted October 17, 2006 Author Share Posted October 17, 2006 Lucian,Although the super-convoluted way in which i tried to do this didn't work, i just realized that there is a much simpler way of doing this. i don't need the hyperlink hashmap that i have created. just adding the $F{} in the anchorName and the hyperlinkanchor expression is more than enough.Thanks a lot for your time. I am withdrawing my erroneous conclusion about hyperlinks.Thanks,nilesh Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now