Notifications
Clear all

[Solved] Creating a custom link from a report

   RSS

2
Topic starter

How do I create a custom link to another page for a report column?

2 Answers
2
Topic starter

You can customize the rendered html for a report column using One.Report.setRendererByName(), and that can be used from within a report plugin.

Below is a code snippet which uses the One.LinkUtil API to generate the hyperlink to the new tab/perspective. One thing to note is that the Type of the RetrievalField or CustomRetrievalField in the report should be a HYPERLINK, not a STRING (STRING will escape any HTML tags in the value).

SHOW.ReportPlugin = {
  init: function(report) {
    report.setRendererByName('SHOW$Task$Field1', function(value, metadata, record, rowIdx, colIdx, store) {
      return One.LinkUtil.getNewTabLink({
        url: One.LinkUtil.getPanelUrl('SHOW.PanelToOpen', { someConfig: value })
        ,text: 'Link Text'
        ,title: 'Tab Title'
      });
    });
  }
};

@sean-durkin In the report A, which is the widget that getting the data from. There's another report B, which is the Search Shipment Report aka the report that we are trying to create the hyperlink. In the documentation, it said "can add listeners for the events that the report fires or can even modify the report object directly". Would that be possible to open report B with each column from widget, and set it to different filter for each of the report that is being opened?

0

@sean-durkin By using HYPERLINK instead of the DOUBLE, the Analytical (Pivot) Widget no longer have the correct sum value for the count. Is there a way to get around it. 

 

            <CustomRetrievalField>
                <FieldRef levelType="ShipmentHeader" category="PDF">
                    <FieldName>CartonCount</FieldName>
                </FieldRef>
                <Type>HYPERLINK</Type>
                <SimpleMapping sqlName="CARTON_COUNT"/>
            </CustomRetrievalField>

@cliu If you're trying to use this report from within a widget, then the widget should have some kind of plugin mechanism for creating a clickable count. I wouldn't recommend trying to use this report standalone AND within a widget, because the approaches to the CartonCount column would be different; if you need that, then I would probably just have 2 separate reports.

The main purpose for this report is for the widget, we can forget about the report standalone. I was able to see the sum value from the report, but in the widget it was all showing 1.

© 2020 One Network Enterprises. All rights reserved. Privacy Policy