Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Hyperlink with label

  1. #1
    Join Date
    Jul 2017
    Posts
    2

    Question Hyperlink with label

    Hi,

    I know this question as been answered before, but I can't get this to work. I'm trying to have a column in each row of my table that has a link with the label 'Print Report'. When someone clicks the link they should go to the URL of the report.

    I have query that returns the URL from the database in this format: [Print Report][http://biserver:8080/pentaho/api/repos/.../report.prpt]. Then I'm using this code provided in the Leaning Pentaho CTools book in the Pre Execution field, but it doesn't work:



    function f(){

    var options = {
    openInNewTab: true,
    prependHttpIfNeeded: true,
    regexp: null,
    pattern: "/\[(.*?)\]/g",
    urlReference: 2,
    labelReference: 1
    };
    this.setAddInOptions("colType", "hyperlink", options);

    }


    What happens is this:

    Name:  table.jpg
Views: 66
Size:  13.2 KB

    As you can see instead of the label what I get is exactly what is returned by the query.

    Can anyone help me solve this problem?

    Thanks in advance.


    Best regards,
    Pedro
    Last edited by pmeireles; 07-05-2017 at 09:41 AM.

  2. #2
    Join Date
    Nov 2012
    Posts
    24

    Default

    Pedro,

    Use the following code, that should work for you:



    function() {
    var options = { openInNewTab: true,
    prependHttpIfNeeded: false,
    regexp: null,
    pattern: /\[(.*?)\]/g,
    urlReference: 1,
    labelReference: 0
    };
    myself.setAddInOptions("colType", "hyperlink", options);
    }

    Best regards,

    Miguel Gaspar
    "Leaning Pentaho CTools"

  3. #3
    Join Date
    Jul 2017
    Posts
    2

    Default

    Finnaly it's working! It seems the problem had something to do with the quotes on the pattern variable.

    Thanks Miguel.


    Regards,
    Pedro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.