Search code examples
pentaho-cdepentaho-ctools

Displaying data with query component on Pentaho CDE


I want to display a data (in my case, a String) by using Query component on Pentaho CDE. However, nothing is displayed.

Here is what I did:

On DataSource Panel:

enter image description here

The query is

select city_name from tb_city where city_id='1';

and it gives 'NYC' as result.

Then On Component Panel - Query Component:

enter image description here

With a JS function on Post Execution:

function f() {
document.getElementById('header_c').innerHTML =myresult; }

where header_c is the name of the column where I want to display the query result.

I think there's no prob with this function and other stuffs because when I change myresult to any string like 'HELLO' in the function, it's displayed.

Does anyone have an idea where's wrong? I verified and the query has no prob.


Solution

  • write this code in your post fetch. where abc is Result Var

    function fun(abc) { 
    document.getElementById('qq1').innerHTML =abc.resultset;
    }