Pentaho

 View Only

 Access to table component's record set from button click

  • Pentaho
  • Ctools
  • Pentaho
Glupe Registracije's profile image
Glupe Registracije posted 09-28-2018 07:51

Hi,

if I have a table component with underlying data source, how can I access datasource records from button click JavaScript ?

Let's say that I have a huge clickhouse (database) table (with billions of records). I have a datasource that extracts 50 records from that table, that will be shown in pentaho table component.

Now on button click, I would like to calculate some statistics for these 50 records, but I would like to avoid using new sql queries in order to speed up loading pentaho page.

What I need is access to these 50 records, so I can loop through them, find minimum, maximum, count of certain type of records and so on.

How to access table component record set from button click?

Regards.


#Pentaho
#Ctools
Joao Figueiredo's profile image
Joao Figueiredo

Hi,

You are talking about CTools dashboard, or from a report?

Glupe Registracije's profile image
Glupe Registracije

I am talking about CTools dashboard.

Joao Figueiredo's profile image
Joao Figueiredo

Can't you use directly the available aggregation functions from the datatable itself? Look here Use Data Tables in a Dashboard - Pentaho Documentation , that way you can have the aggregations made on the front-end from the table dataset.

If you really need to make it through a button, then I would try to add the necessary logic from within the datatable post fetch. There you have access to the data, and can crunch the numbers and make it readily available for whenever someone presses the button.

Glupe Registracije's profile image
Glupe Registracije

I prefer post fetch approach. So, you are suggesting to me to crunch numbers in post fetch, than to set some parameters and finally, to use that parameters on button click?

I hoped that I will be able from button click to locate table component, than its record set, and do whatever I want here instead of post-fetch in order to prevent introducing parameters.

Is something like this possible?

  1. Regards.