Generate a Dynamic Hyperlink from XML Data

Options
megschiru
edited February 11, 2022 in Analytics #1
<p>Hi,</p>
<p> </p>
<p>I have an XML dataset with values in the following format:<br><br>
            name            value          <br>
          
|
|<br>
            ip             |   192.168.1.17   |<br>
            port         |    8080                |<br>
            suburl      |   report1             |<br><br>
Now I have to put an generate an hyperlink, with a combination of the data.<br>
For example: <a data-ipb='nomediaparse' href='http://192.168.1.17:8080/birt/run?__report=test.rptdesign'>http://192.168.1.17:8080/birt/run?__report=test.rptdesign</a></p&gt;
<p> </p>
<p>How to go about this. Please point me in the right direction.</p>
Warning No formatter is installed for the format ipb

Comments

  • <p>Use that JavaScript option in the hyperlink editor. See image</p>
  • <p>I have tried something along the following lines:</p>
    <ol><li>Created a table of the XML dataset. Made it invisible.</li>
    <li>
    <p>Created the following script on the table onCreate</p>
    <span>var</span><span> index</span><span>;</span><br><span>myArray </span><span>=</span><span> </span><span>new</span><span> </span><span>Array</span><span>(</span><span>10</span><span>);</span><br><span>for</span><span>(</span><span>index</span><span>=</span><span>0</span><span>;</span><span> index </span><span><</span><span> myArray</span><span>.</span><span>length</span><span>;</span><span> index</span><span>++)</span><span> </span><span>{</span><br><span>myArray</span><span>[</span><span>index</span><span>]=</span><span>row</span><span>[</span><span>'value'</span><span>];</span><br><span>}</span></li>
    <li>
    <p>I'm using "http://"+myArray[0]+":"+myArray[1] in the hyperlink</p>
    <span>But</span><span> I</span><span>'m getting the following result: <a data-ipb='nomediaparse' href='http://192.168.1.17:192'>http://192.168.1.17:192.168.1.17</a></span></li&gt;
    </ol><p>I think all the array elements seems to contain the first row of the table only.</p>
    Warning No formatter is installed for the format ipb
  • <p>Try putting the script on the detail row of the table.</p>
  • <p>Tried it. Not working</p>
    Warning No formatter is installed for the format ipb
  • <p>Can you provide a sample XML file and Design?</p>
  • <p>Here are the xml and design files. You can see from the design, I've tried using 2 options : 1)Binding to the table 2)Binding to the data set. Both options are not working
    Warning No formatter is installed for the format ipb
  • micajblock
    edited November 18, 2014 #8
    Options
    <p>Apologize for the delay I have been on the road for a while. Attached is a new design that works. You have a couple of mistakes in your code. First the onCreate method will get called every row so your array gets initialized every row. So I initialize the array and index in the beforeFactory event of the report. Second in script to access row data it is slightly different that expression builder. </p>
    <p>BTW, here is a video of mine that explains the order of event.</p>
    <p> </p>
    <p>https://www.youtube.com/watch?v=FQ9VjByPNWM&lt;/p&gt;
  • <p>Yes. Works Perfectly. I could figure out that only the first row of the table is getting into the array. But i did not know how to solve the issue. Thanks a Lot, Mr. Block.</p>
    Warning No formatter is installed for the format ipb