[英]Pentaho CDE “All” options in multiselect component
所有! 我試圖解決我的問題,但我需要幫助。 我使用Pentaho CDE,我有一些選擇組件和表格。 我需要像參數一樣將數據從多個選擇器傳輸到表。 我閱讀了許多有關此問題的主題,但尚未找到答案。 我看到如何在CDE中添加全選選項以選擇組件,而在“選擇”組件中選擇Pentaho CDE“全部”選項,我有以下代碼:
where (a.Group in (${group_par}) and a.Event_type in (${event_type_par})) or (a.Group like (case when ${group_par} = 'ALL' then '%' ELSE ${group_par} end))
當我選擇“全選”時,選項正常工作,當我選擇一個參數時,選項正常工作,但是當我選擇多個參數時,查詢不起作用。
多選組件將值作為數組提供。 我們需要將其轉換為帶引號的值。 我們可以將其寫在組件的post change事件中。 下面是您可以使用的示例代碼。
if(group_par.length >= 1 ){
for(i=0;i<group_par.length;i++){
if(i==0){
testString ="";
}
else{
testString =testString + "',";
}
testString =testString + "'" + group_par[i]
if(i==group_par.length-1)
{
testString =testString + "'";
}
}
現在,新變量將是teststring而不是group_par
希望對您有所幫助...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.