Issue in Hyperlink between Dataset in BIRT Report

MAX092012
edited February 11, 2022 in Analytics #1

There is a BIRT report which has 3 datasets and all the 3 data set has a field LOCATION. This field should have hyperlink to move from first dataset to second data set and then to third dataset. It is not necessary that all the 3 dataset would always have values. If all the 3 dataset has values then the hyperlink moves from First data set to second and then from second data set to third data set. However if there are only 2 dataset then the hyperlink does not move from first data set to second data set. Below is the current hyperlink and bookmark that I have used, Please let me know your thoughts.

**first dataset **
hyperlink - "LEV2~"+row["location"]
bookmark - "LEV1~"+row["location"]
table of contents -
**second dataset **
hyperlink - "LEV3~"+row["location"]
bookmark - "LEV2~"+row["location"]
table of contents -
**third dataset **
hyperlink - "LEV2~"+row["location"]
bookmark - "LEV3~"+row["location"]
table of contents -

Comments

  • I don't understand your question. Can you clarify?

  • I don't understand it either
    @MAX092012 what do you mean by
    1) Move from a dataset to other dataset?
    2) What is "table of content" below?
    Please share a sample report, that will help to understand the issue.

    Regards,
    Shweta Parihar

  • Hi Eric & Shweta,
    Thanks for your reply. I have attached a sample report, This report has 3 levels ( 3 data set) and user will enter a report parameter by the name Report Level = 1 or 2 or 3 . If user enters 3 then all the 3 data set would be displayed in the output , if user enters 2 then only first 2 data set would be displayed in the output.
    There is a column - LOCATION ( blue color) which is a hyperlink and user when clicks on this in the first data set then it would move to the corresponding location in the second data set and then from second data set to the third data set.
    The issue is that when Report level = 3 then the hyperlink moves from 1 to 2 , 2 to 3 however 3 to 2 and 2 to 1 does not work.
    If report level = 2 then the hyperlink from 1 to 2 does not work at all.

  • I was unable to attach it in my previous post , hence attaching the report separately. Thanks!!

  • Can anyone please help me on this, I'm still unable to determine a fix.. Thanks!

  • You said, "If report level = 2 then the hyperlink from 1 to 2 does not work at all." Isn't that the scenario from the other thread that was working?

    It isn't possible to link backwards using the solution from the other thread (3 to 2 to 1). It's a timing issue. Also, when the user clicks 2, how would you know if they are going to 3 or back to 1?

    Are all 3 tables displayed on one page? If so, you could do the linking in JavaScript.

    Warning No formatter is installed for the format ipb
  • MAX092012
    edited March 25, 2020 #8

    Hi Jeff,
    To answer your question yes it was working before but then if the data is not there then the hyperlink gave exception. But in some scenario it never worked.. The requirement is to move from 1 - 2 - 3 and 3 -2 -1 or 1 - 2 and 2 -1.
    All the 3 tables are not displayed in 1 page. But if using JavaScript this would work then I can try to get these 3 tables displayed in 1 page itself. Can you please suggest an example javascript? Thanks!

  • I don't have time right now to debug your report, but I will attach a JavaScript example.

    Warning No formatter is installed for the format ipb
  • Hi Jeff,
    Thanks for your reply! I'm not sure whether I can use the javascript along with the conditional hyperlink that you had suggested in the other question I had posted. I shall try to figure out a way. Thank you very much for your help and time.

  • jfranken
    edited March 27, 2020 #11

    If you are able to use JavaScript, don't use the method from the other post. Put logic in your JS code to check if the target is valid and don't scroll if there isn't a valid target. I haven't tried to implement it. My example shows how to add an ID to the element. Maybe you could also add a class like: <div class="table2"> to indicate the table containing the data. When the user clicks a link that is supposed to target table 2 only when there is a matching value, check all elements of the class to see if they have the required value before scrolling using something like:
    https://stackoverflow.com/questions/31632969/select-div-class-containing-specific-text

    Warning No formatter is installed for the format ipb
  • Hi Jeff,
    Based on your example the java script is getting displayed as a text instead of the desired output. I have never written java script in birt reporting before hence I assume there is some mistake and I'm unable to figure out the same. Is it possible for your to help me out.. Also can you please advise where should I  add <div class="table2"> to indicate the table containing the data. 
  • Changing the Text element from "Auto" to "HTML" will fix the first issue:


    The attached report is a simple example of how to add a div with a class.  The first column in the Table element on the report is a normal Data element.  The second column contains a Text element with the data wrapped in a div tag.  The  "<VALUE-OF>" icon on the Text element toolbar helps to select and insert  data in the Text element (click it).

    In the browser, you can see that the class was added correctly:


    I added a Text element at the top of the report to show how to use the added class.  In your case, you will probably want to replace the "alert" code with code to scroll to another element.  To test my code, simply run the report and click a name in the second column.
    Warning No formatter is installed for the format ipb
  • MAX092012
    edited April 15, 2020 #14
    Hi Jeff,
    Sorry to bother you! I tried to look into your sample report however I do not understand how to get move from 1 dataset to another. In the alert code that you had provided as a sample what does myTable1 refer to ? I have tried to write the alert however the move doesn't work. The locations do appear as hyperlink however nothing happens after that. Also I'm not sure whether we can conditionally enable the hyperlink here. 
  • jfranken
    edited April 15, 2020 #15
    The first sample report I shared (link.rptdesign) included code to scroll to an element.  The second example (sample_div.rptdesign) showed how to add the table name to each element (table cell) as a class.  The simplest solution to implement your end requirements I can think of is to use the code from those examples along with the jQuery "find" method (https://api.jquery.com/find/ ). 

    Your requirement is to go to an element in a specific table where the element contains matching text to the value that was clicked.  I did a quick search and found this example:

    Pass the value clicked to the jump() function from my first example.  Add find() as a call inside jump().  The find() call will return an array of elements.  You will likely want to scroll to the first element in the array.  Also, handle the case where no matches are found (do nothing or display some sort of notification).

    Warning No formatter is installed for the format ipb