Documentation: Data Tables

Below you will find scripting instructions for controlling data tables. With InetSoft's flexible data intelligence software, casual end users can drag and drop a data table onto a visual report or dashboard, and power users and developers can control virtually every aspect of a data table.

InetSoft How-to:

Tables offer a number of special properties that allow you to access the data values from script, and to add visual style to rows, columns, and individual cells. The following sections explain how to use these properties.

Accessing Table Data

There are two key properties for accessing the values in a table, table and data.

  • table – A two-dimensional array containing the table data as displayed. The array includes header rows as well as data rows.
  • data – A two dimensional array containing the raw table data (prior to grouping and summarization). It does not include header rows.

Two sub-properties that are especially useful when looping through the rows or columns of tables are 'length' and 'size'.

Note: A table that returns no data still displays the column header row. Therefore, table.length is 1 in the no-data case.

  • table.length/table.size – The number of rows and columns (respectively) in the table, as displayed, including column header row.
  • data.length/data.size – The number of rows and columns (respectively) in the original table (prior to grouping and summarization), including column header row.

As an example, consider the following table script, which iterates through all data rows (beginning with row index 1, the first data row) and columns of a table, and cumulatively sums these values.

var tot = 0;
for(var row = 1; row < table.length; row++) {
   for(var col = 0; col < table.size; col++) {
      tot = tot + table[row][col];
   }
}
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

Setting Cell and Row Visual Properties

There are variety of properties for setting aspects of row, column, and cell visual presentation. Some common properties are listed below:

  • cellForeground – Text color of the cell specified by row and column indices.
  • cellForeground[1][3] = [123,0,123] 
  • cellBackground – Fill color of the cell specified by row and column indices.
  • cellForeground[1][3] = [123,0,123] 
  • colFont – Font settings for column specified by integer index or name.
  • colFont['Total']='Verdana-Bold-14' 
  • colWidth – Width in points for column specified by integer index or name.
  • colWidth['Total Sales'] = 0 
  • rowHeight – Width in pixels for row specified by integer index.
  • rowHeight[3] = 0 
  • rowBackground – Fill color of the row specified by the integer index
  • rowBackground[5] = [255,0,0] 
  • setHyperlink(row, col, hyperlink) – Hyperlink for cell specified by row and column indices.
setHyperlink(1, 1, "Tutorial/Ad Hoc");
top ranked BI
Read how InetSoft was rated as a top BI vendor in G2 Crowd's user survey-based index.

Displaying Images in Table Cells

A script can load an image file as a resource, as long as the file is located on the classpath (i.e., within a classpath directory, or within a JAR file on the classpath). To load the image into a report, use the global getImage() method.

var onIcon =
  getImage('/inetsoft/report/painter/images/checkon.gif');

var offIcon =
  getImage('/inetsoft/report/painter/images/checkoff.gif');

Once you have loaded an image, you can assign it to a table cell as a regular data object. For example, the script below replaces true and false with the “checkmark” images loaded earlier.

for(var r = 1; r < table.length; r++) {
  if(table[r][1]) {
    table[r][1] = onIcon;
  }
  else {
    table[r][1] = offIcon;
  }
}

You can also load an image from an ASCII-encoded string, such as an XML file. (ASCII Hex and ASCII85 are supported.) If the argument to getImage() does not point to a valid resource, then the parameter is treated as an encoded image.

// picture column is ascii85-encoded gif image
for(var r = 1; r < table.length; r++) {
  var img = getImage(table[r]['picture']);
  table[r]['picture'] = img;
}

More Articles About Data Management

Decision Management for Border Control - Border control, that's an interesting one. We actually saw one European government, they implemented a system using our technology to pre-validate all the customs declarations that crossed the border. They have 200,000 of these a day and instead of waiting for all these goods that cross the border to be validated right at the border, they do this in advance, and they run this through a series of business rules to determine whether it is a valid custom's declaration. So you know just there are a lot of cases for predictive analytics. I was presenting last week and one slide was completely devoted to all the different ways in which business rules and decision management can be used in account opening and account management, and the list was very long. There were 16 different...

Different Ways You Can Visualize Data - Some other ways you can visualize the data instead of a simple X and Y is multi dimensional visualization. Here we're looking at data where we not only have an X and Y, but we have colored, sized and shaped our data. Again we can do explicit filtering. I can choose to look a specific region, say the west coast, and you notice that whenever you make a selection with the selection element all of the other selections are filtered based on the same underlying data. The reason for that is because within the west region there are only two divisions. So we're saying, based on your initial selection, these are the other valid selections that you can make...

Home Builder Reports - Home builders rely on a variety of reports to effectively manage their projects, resources, finances, and customer relationships. Automating the emailing of reports to managers ensures timely access to critical information, enabling informed decision-making and proactive management. Here are some reports that a home builder might automatically email to managers: Project Status Reports: These reports provide an overview of the status of ongoing construction projects, including milestones achieved, tasks completed, and upcoming deadlines. They may also include information on project timelines, budget vs. actual expenditures, and any issues or risks that needHome builders rely on a variety of reports to effectively...

Information Management System Implementation Time - Now some people might be wondering, "how long does it take to complete an information management system?" In regards to how long the implementation should take, I imagine that there are a various number of different factors involved especially if the plan goes as planned, or it doesn't. What would I tell a company who wanted a time estimate upfront? How long would their implementation take? You have to hit them down on the head. It really is more art than science. It's not an algebraic equation or a recipe. It's not a two parts data cleansing and one part training where you come up with some sort of number. Certainly...

Interviewing People for Scorecard Input - The interviews, of course, are extremely important because there is nobody that knows these organizations better than the people that work there. And in many cases, I have got to tell you, again, it's not rocket science. I just write down what people tell me and put it in a right framework and then work on what would the impact be if you could resolve that. So that's the first part here. Usually what comes out of that is some kind of a self-assessment. Self assessment is very important. Rather than me going in there and telling them, you stink at this, I am going to go in and say look, I have worked with companies that are very good in this particular area, there is this little area, and here are the things that they do that make them better, or the things that they do that make them excel in that area...

Treasury Software Reports - Treasury software is designed to streamline and automate financial operations related to cash management, liquidity management, risk management, and financial reporting within an organization's treasury or finance department. The software typically includes a variety of reports to provide insights into cash flows, investment portfolios, debt management, and compliance with regulatory requirements. Here are some common types of reports that would be included in treasury software: Cash Position Reports...

Previous: How to Find the Difference Between Dates Next: Formula Tables