How to add hyperlink to a field ( Ex : Policy Number) in a dashboard.

Comments

10 comments

  • Avatar
    Tal Admon

    Hi Satish,

    Here's a script example for a pivot table.

    It assumes that the policy ID is on the left-most column, and that you can concat this id to the admin_url and get the policy URL directly. 

    widget.on('ready',function(se,ev) {
    var admin_url = 'https://my.admin.com/policy/' ;
    $(element).find('tbody').find('td[fidx="0"]').find('span').each(function(){
    var x = $(this).html();
    $(this).html('<a href="'+admin_url+x+'" target="_blank">'+x+'</a>')
    });
    })

    It will replace the value of this column to a link for the policy. target="_blank" will make sure that the link will be opened in the new tab.

    Regards,
    Tal

    0
    Comment actions Permalink
  • Avatar
    Satish Vantaku

    Hi Tal,

    Thanks a lot for the help, now we are able to enable hyperlinks on the ID column.

    We have an admin URL of below format :

    var admin_url = 'http://sfoepr01./ipb-app/faces/work/task-details.xhtml?id=27722&_windowId=W1526366389940#noback';

    When the user click on different policy id, that should get inserted into above URL ( EX : id 27722 should change when a user clicks on different id, can we do that.

    Regards,

    Satish

    0
    Comment actions Permalink
  • Avatar
    Tal Admon

    So the _windowId is fixed? if so, you can do:

    var admin_url = 'http://sfoepr01./ipb-app/faces/work/task-details.xhtml?id=';

    var post_url = '&_windowId=W1526366389940#noback';

     $(element).find('tbody').find('td[fidx="0"]').find('span').each(function(){
    var x = $(this).html();
    $(this).html('<a href="'+admin_url+x+post_url'" target="_blank">'+x+'</a>')
    });
    0
    Comment actions Permalink
  • Avatar
    Satish Vantaku

    Hi Tal,

    Thanks for the script, its working. But only problem here is when we edit the widget, then we are able to click on the policy number and navigate to the hyperlinked URL.

    When we open the report normally without editing it, then hyperlink does not work. can you help me in solving this.

     

    Regards,

    Satish

    0
    Comment actions Permalink
  • Avatar
    Satish Vantaku

    Hi Tal,

    Do we need to add the script on the main widget as well.

    At present we have edited the report and then went to edit script and uploaded the script which you have provided. Do we  need to open the dashboard as it is and update the script there as well.

    Ex: once we click on options ( which is beside the switch to view mode and we have edit script, do we need to insert any script over there?

    Right now we have inserted script in the edit widget --> options --> edit script

    Regards,

    Satish

    0
    Comment actions Permalink
  • Avatar
    Tal Admon

    This should be a widget script, so what you did sounds like the right thing to do.

    Make sure you have the entire script there, not just what I wrote on my 2nd comment: 

    widget.on('ready',function(se,ev) {
    var admin_url = 'http://sfoepr01./ipb-app/faces/work/task-details.xhtml?id=';
    var post_url = '&_windowId=W1526366389940#noback';

    $(element).find('tbody').find('td[fidx="0"]').find('span').each(function(){
    var x = $(this).html();
    $(this).html('<a href="'+admin_url+x+post_url'" target="_blank">'+x+'</a>');
    });
    })

    Save the widget script (from widget --> options --> edit script), go back to the edit widget page, refresh the page and click apply to return to the dashboard.

    You should see the script gets applied when on the widget in the dashboard.

    If not, I suggest contact Sisense Support...

    Hope that helps,
    Tal

    0
    Comment actions Permalink
  • Avatar
    Satish Vantaku

    Hi Tal,

    Thanks for the update. 

    we have a dashboard with summary and details reports. When i try to edit the summary report and  insert hyperlink script, it works. when i edit the detailed report and insert the hyperlink link script it doesn't work. Not sure why its happening.

    One more observation from my side, i have added 2 screenshots, when we have (save a copy/edit script/analyze Jsql) the hyperlink script does not work. When we have all the other options ( save a copy/edit script/selection /widget effects/drills/analyze) then hyperlink script is working.

    Regards,

    Satish

    0
    Comment actions Permalink
  • Avatar
    Satish Vantaku

    Hi Tal,

    Can we add different hyperlinks to a single report.

    Ex: we have two database (Oracle & MSSQL) when we point the report to oracle the hyperlink should open Oracle UI and when we point the report to MSSQL the MSSQL hyperlink should come up.

    Can we do this.

     

    Regards,

    Satish

    0
    Comment actions Permalink
  • Avatar
    Vikas Sharma

    but in our case links are working for the first page of the table and when clicking on another page disappearing , Please suggest what can be the reason

    0
    Comment actions Permalink
  • Avatar
    Jessica Orlando

    This is great! Is there a way to display the 'Company Name' instead of the ID for the URL field (but the ID is still what is used to navigate to the hyperlink site)?

    0
    Comment actions Permalink

Please sign in to leave a comment.