我将javascript代码用作TamilNadu地图的外部文件,并将以下SQL代码用于pentaho的表组件。
现在,通过单击按钮,我想通过将javascript变量作为参数来显示表格。
javascript代码:-
var js_city = 'coimbatore';
SQL代码:
SELECT
CONCAT(UCASE(LEFT(A, 1)), SUBSTRING(A, 2)) AS 'Service Center Name',
CONCAT(UCASE(LEFT(B, 1)), SUBSTRING(B, 2)) AS 'State',
CONCAT(UCASE(LEFT(C, 1)), SUBSTRING(C, 2)) AS 'Status'
FROM
(SELECT
LOWER(A.service_center_name) AS A,
A.status AS C,
LOWER(C.branch_name) AS 'B'
FROM
customers A
INNER JOIN ascs B ON A.serv_cent_mob_no = B.contact_number
INNER JOIN branches C ON B.branch_id = C.id
GROUP BY A.service_center_name , A.status , C.branch_name) AS Issue
WHERE B=${sqlcity};
如何在pentaho中将“ js_city”变量作为“ sqlcity”参数传递?
答案 0 :(得分:2)
例如:
1。最初将 countryName()定义为外部js。 2.简单的参数名称是: cityPara 3.转到pentaho cde->组件面板->脚本->功能->您必须调用外部js值并设置参数值。 功能脚本:
function countryName(){
dashboard.fireChange('${p:cityPara}',js_city);
console.log("countryName :", js_city);
}