Adding CrossTrack Links to standalone and parent reports
Follow this procedure to add a CrossTrack link to a standalone or parent report.
Procedure
- Create a new list report.
- From the Query Explorer, open the query.
- In the Properties pane under Miscellaneous, set the name to listMain.
-
From the Page Explorer, select the main report page, and complete the
following steps.
- Click the Source tab in the Insertable Objects pane.
-
Drag the following query items into the List object box:
-
DEFAULT|[DEFAULT_REL]|GRC_OBJECTS|[SOXCONTROL]|[CN_NAME00]
-
DEFAULT|[DEFAULT_REL]|GRC_OBJECTS|[SOXCONTROL]|[CN_DESCRIPTION]
-
DEFAULT|[DEFAULT_REL]|GRC_OBJECTS|[SOXCONTROL]|ENUMERATION_FIELDS| CLASSIFICATION (ENUMERATION)|[CN_CLASSIFICATION]
-
DEFAULT|[DEFAULT_REL]|GRC_OBJECTS|[SOXCONTROL]|ENUMERATION_FIELDS| DESIGN_EFFECTIVENESS (ENUMERATION)|[CN_DESIGN_EFFECTIVENESS]
-
DEFAULT|[DEFAULT_REL]|GRC_OBJECTS|[SOXCONTROL]|[CN_DETAIL_PAGE_URL]
-
-
Select the
[CN_DETAIL_PAGE_URL]
column in the report and cut it (not delete it). -
To change the list column titles, complete the following steps.
- Select each list column title.
- In the Properties pane under Text Source, set the Source Type property to Text.
-
Double-click in the Text property and type in the appropriate title
value. Set the headers to the following values:
[CN_NAME00]
to Control Name.[CN_DESCRIPTION]
to Description.[CN_CLASSIFICATION]
to Classification.[CN_DESIGN_EFFECTIVENESS]
to Design Effectiveness.
-
Add the following JavaScript to the report:
Drag an HTML Item to the beginning of the report.
Double-click the HTML Item and enter the following code:
<script language="javascript"> function _fixUpLinkTarget() { var crossTrackLinks = document.querySelectorAll('a[href^="javascript:crosstrack("]'); for (var i = 0; i < crossTrackLinks.length; i++) { crossTrackLinks[i].target = ""; } } _fixUpLinkTarget(); var _crosstrackTargetWindow; function _discoverCrosstrackTargetWindow() { if(!_crosstrackTargetWindow || typeof(_crosstrackTargetWindow)=='undefined') { var win; if(!window.opener || typeof(window.opener)=='undefined') { win = window.parent; } else if(!window.opener.opener || typeof(window.opener.opener)=='undefined') { if(!window.opener.parent || typeof(window.opener.parent)=='undefined') { win = window.opener; } else { win = window.opener.parent; } } else { win = window.opener.opener; } _crosstrackTargetWindow = win; } } _discoverCrosstrackTargetWindow(); function _crosstrack(url, targetWin) { if(!targetWin || typeof(targetWin)=='undefined') { if(!window.opener || typeof(window.opener)=='undefined') { targetWin = window.parent; } else if(!window.opener.opener || typeof(window.opener.opener)=='undefined') { if(!window.opener.parent || typeof(window.opener.parent)=='undefined') { targetWin = window.opener; } else { targetWin = window.opener.parent; } } else { targetWin = window.opener.opener; } } try { targetWin.location.href=url; targetWin.focus(); } catch(err) { window.open(url); } } function openResourceInNewUI(url) { var resourceName; var resourceId = url.substring(url.indexOf("fileId=") + 7, url.length); var targetOrigin = url.substring(0, url.indexOf("view.resource.do") - 1); var resourceNameSpans = document.querySelectorAll('a[href^="javascript:crosstrack(\'' + url + '"] span'); if (resourceNameSpans && resourceNameSpans.length > 0) { resourceName = resourceNameSpans[0].innerText.trim(); } window.top.postMessage( { "resourceId": resourceId, "resourceName": resourceName }, targetOrigin ); } function crosstrack(url) { if (document.cookie.indexOf("op-last-accessed-ui=task-focused") > 0 && url.indexOf("view.resource.do") > 0) { openResourceInNewUI(url); } else { _crosstrack(url, _crosstrackTargetWindow); } } </script>
- Click the Toolbox tab , and then drag a Hyperlink object into the first column of the list report.
- From the toolbar, click the Lock icon to unlock the template (the icon changes to unlocked).
-
To make the hyperlink data item a property of the list, complete the following steps.
- Select the List object from the main report page.
- In the Properties pane under the Data category, click Properties.
-
Select
[CN_DETAIL_PAGE_URL]
. - Click OK.
-
To configure the Hyperlink object, complete the following steps.
- Click the Hyperlink text in the cells of the Hyperlink object column.
-
In the Properties pane under the Text Source
category, set the Source Type property to Data Item
Value and the Data Item Value property to
[CN_NAME00]
. - In the Properties pane under the URL Source category, set the Source Type property to Report Expression.
-
Click in the Report Expression property and enter the following JavaScript code in the Expression
Definition pane:
if (ReportOutput()="HTML") then ("javascript:crosstrack('"+ [listMain].[CN_DETAIL_PAGE_URL] + "');") else ([listMain].[CN_DETAIL_PAGE_URL])
Note: The items in italics are the values that need to be replaced when you implement this on your system. - Select the column header text in the Hyperlink object.
- In the Properties pane under the Text Source category, set the Text property to Control Name.
- From the Toolbar, click the Padlock button again to lock the template (the icon changes to locked).
-
Select the original
[CN_NAME00]
column (not the hyperlink column) on the report page and then cut it. -
Run the report.
Note: To test the CrossTrack link, the report must be published and run from OpenPages® with Watson™.
Results