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
- 123 Developer Announcements
- 54 Articles
- 153 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories