Make Hyperlink dinamically using window.location.origin
Hello,
I'm using Analytics Designer to make reports into D2 application.
My organization has several environments as DEV, TEST, QA… my question is below.
I have a table with a Data item that is linked to hyperlink URI as → "http://mydevD2/D2?…"
I'm trying to change the literal “mydevD2” dinamically using a script onCreate handler in the data Item as:
this.action.setHyperlink("http://" + window.location.origin + "/D2…, "_blank");
Seems that window.location.origin (DOM)) is not accessible from here. Anyone can suggest how it could be implemented?
Regards
Sergi
Comments
-
Hello,
<script>
Finally i found a workoaround after lot of trial and error. Below you can found my solution.
In a table cell I add a Text Item to script following lines:
environment = window.location.origin + "/D2?docbase=****&locateId=" + "<VALUE-OF>row["r_object_id"]</VALUE-OF>";
var getWebsite = document.getElementById("<VALUE-OF>row["r_object_id"]</VALUE-OF>");
getWebsite.innerHTML = '<a href="' + environment + '#d2" target="_blank" ><VALUE-OF>row["object_name"]</VALUE-OF></a>';
</script><span id="row["r_object_id"]">
Environment is a string that contains url using origin property + literal + the r_object_id value from Data Item.
Then I get the span item in HTML that was created and taked using the value of r_object_id to be unique.
Finally script inner HTML with tag and the right url for each environment.
Regards0
Categories
- All Categories
- 117 Developer Announcements
- 52 Articles
- 145 General Questions
- 132 Services
- 56 OpenText Hackathon
- 35 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 8.9K Extended ECM
- 912 Cloud Fax and Notifications
- 81 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 162 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 4 XM Fax