0

Below example is to get rows or column names. I want to hide column names by indexing only and not by column name.Is it possible to get column name by indexing using table element? I also want to hide rows based on indexing. Please provide solution?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  <title>Viewer Page</title>
</head>

<body onload="init()">
  <script type="text/javascript" language="JavaScript" src="http://localhost:8700/iportal/jsapi"></script>
  <script type="text/javascript" language="JavaScript">
  function init() {
    actuate.load("viewer");
    actuate.load("dialog");
    actuate.initialize("http://localhost:8700/iportal", null, "administrator", null, runReport);
  }

  function runReport() {
    var viewer = new actuate.Viewer("viewerpane");
    var manUIOptions = new actuate.viewer.UIOptions();
    manUIOptions.enableToolBar(false);
    manUIOptions.enableFilter(true);
    viewer.setUIOptions(manUIOptions);
    viewer.setReportName("/Resources/xyz.rptdesign");
    viewer.submit(getColumnAndHide);
  }
  callBackError = function(exception) {
    window.alert('ERROR: ' + exception);
  };

  function getColumnAndHide(viewer) {
    var myTable = viewer.getCurrentPageContent().getTableByBookmark("detail");
    //var myColumn=myTable.getColumnName(2);
    //myTable.getRow(2);
    myTable.submit();
  }
  </script>
  <div id="viewerpane"></div>
</body>

</html>
Mike Cluck
  • 31,869
  • 13
  • 80
  • 91
Avinash Kharche
  • 411
  • 9
  • 25
  • Stack Overflow isn't a code writing service. What have you done to try and solve it yourself? – Mike Cluck May 16 '16 at 22:21
  • I have used var myColumn=myTable.getColumnName(2); but didn't get anything from it. I am looking for some ideas so that i can hide rows and get column names using actuate.data.Table element. and then display that table in the report in the browser – Avinash Kharche May 16 '16 at 22:26
  • Note that that code runs before `viewerpane` exists. `onload` is a bad idea. You want to scatter little scraps of js through your html? Put your JS after the elements it needs and you can just do it right away with no `onload`. – doug65536 May 18 '16 at 23:02

1 Answers1

0

Here's an overview for you. First I would "configure" all inside the birt report, which shall be hidden or not. It's a bad design in my opinion, if the report is manipulated while using it. It could lead to serious race conditions, wrong outcomes and difficult debugging problems. The basics of creating a birt report are pretty much wrapped up here: Vogel, "Reporting with Eclipse BIRT and Java Objects (POJO’s) - Tutorial"

Then, when you have a Dataset or let's say a kind of data container like a variable you can put the content into your Template (*.rptdesign file).

The workflow is as follows:

  • Put a Grid into the page
  • put a label or datacell or whatever can contain variable text into the grid
  • Select the element via point-and-click™
  • In the "Property Editor", there is a Visibility-Tab to click.
  • Enter the correct expression (e.g. JS), Save and Run a Test.

Simple example screenshot

If you like I made a simple example to show you how to hide an element, if a requirement is met. You can download it. BIRT Report Design Example

It's free GNUv2 whatever... Hope this helps you a bit. AFAIK

Semo
  • 783
  • 2
  • 17
  • 38