2013-03-19 106 views
0

這裏是我的輸入控制:如何設置輸入控件的語言?

enter image description here

注意的是,信息在「課程組」(單選擇查詢)是英文

這裏是獲取在「課數據查詢

select distinct(cog.cog_id) id, concat(cd.cd_shortdescription, ' 
(', cn.cn_shortname,' - ', cog.cog_org_be_id, ' - ', cd_code.cd_code, ')') 
coursegroup 
from es_exam_statistics_ft es, cg_classgroup cg, org_organisation org, 
cn_campusname cn, cog_coursegroup cog, cd_codedescription cd, cd_code 
where es.es_cg_id = cg.cg_id 
and es.es_cog_id = cog.cog_id 
and cog.cog_coursegroup_cd_id = cd.cd_id 
and cd.cd_id = cd_code.cd_id 
and org.org_be_id = cog.cog_org_be_id 
and org.org_campusid = cn.cn_campusid 
and cg.cg_startdate >= $P{startDate} 
and cg.cg_enddate <= $P{endDate} 
and cd.cd_language_id = 3 
and cn.cn_language_id = 3 
order by coursegroup 

集團」這個問題帶有我已經做出了大膽的 語言ID的

2=Afrikaans 
3=English 

現在你可以看到,查詢是硬編碼,這樣的語言始終爲英語,所以如果用戶登錄,在不同的語言,在輸入控件中的數據將永遠是英語

我試着用"$P{REPORT_LOCALE}.getDisplayLanguage().equals("English") ? new Integer(3): new Integer(2)" 在報告的XML哪些工作,但在輸入不起作用控制查詢

我怎麼解決這個問題來取代值形式查詢(​​55567)?

+0

你可以看一下[傳遞REPORT_LOCALE不起作用在碧玉即成(http://community.jaspersoft.com/questions/ 531307 /結業reportlocale - 犯規 - 工作碧玉服務)發佈 – 2013-03-19 12:44:04

回答

0

你不能改變輸入的語言控制值,因爲這些值存儲在數據庫中,輸入控制只能從任何數據存儲在數據庫中,如果在數據庫中的存儲在其他語言那麼只有你可以改變輸入數據庫中讀取數據控制值。

要改變在JasperReport的服務器級別的輸入值: -

1:- Create one more input control(p_language) to ask the Language 
        (value column (id) and visible column(language desc)) 

2:- then create a casecading input control to fetch the value of course group 
    using this query. 

    select distinct(cog.cog_id) id, concat(cd.cd_shortdescription, ' 
    (', cn.cn_shortname,' - ', cog.cog_org_be_id, ' - ', cd_code.cd_code, ')') 
    coursegroup 
    from es_exam_statistics_ft es, cg_classgroup cg, org_organisation org, 
    cn_campusname cn, cog_coursegroup cog, cd_codedescription cd, cd_code 
    where es.es_cg_id = cg.cg_id 
    and es.es_cog_id = cog.cog_id 
    and cog.cog_coursegroup_cd_id = cd.cd_id 
    and cd.cd_id = cd_code.cd_id 
    and org.org_be_id = cog.cog_org_be_id 
    and org.org_campusid = cn.cn_campusid 
    and cg.cg_startdate >= $P{startDate} 
    and cg.cg_enddate <= $P{endDate} 
    and cd.cd_language_id = $P{p_language} 
    and cn.cn_language_id = $P{p_language} 
    order by coursegroup 
+0

正如你可以看到查詢有一個過濾器:'和cd.cd_language_id = 3'。我認爲在這種情況下,數據存儲在不同語言的數據庫中。與得到*** *** REPORT_LOCALE爲* JR服務器* – 2013-03-19 12:38:05

+0

@Alex k上的問題:我已經更新了答案 – Sharad 2013-03-19 12:50:45