0

Here is my Input Control:

enter image description here

Note that the Info in the "Course Group" (Single Select Query) is in English

Here is the Query that gets the data in "Course Group"

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

The problem comes with the lines i have made bold Language Id's

2=Afrikaans
3=English

Now as you can see, the Query is hard-coded so that the language is always English, So if a user logs in, in a different language, the data in the input control will always be English

I tried replacing the value 3 form query (and cd.cd_language_id = 3) with "$P{REPORT_LOCALE}.getDisplayLanguage().equals("English") ? new Integer(3): new Integer(2)" Which works in the XML of a Report, but doesn't work in the input Controls Query

How do I solve this issue ?

Alex K
  • 22,315
  • 19
  • 108
  • 236
Andre
  • 661
  • 7
  • 14
  • 29
  • You can look at [Passing REPORT_LOCALE doesn't work in Jasper-Serve](http://community.jaspersoft.com/questions/531307/passing-reportlocale-doesnt-work-jasper-serve) post – Alex K Mar 19 '13 at 12:44

1 Answers1

0

You cant change language of input controls value because these values are stored in database, Input control only fetch the data from database whatever data is stored in database, if in database its stored in other language then only you can change the input controls values.

To change the input values at JasperReport server level :-

 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
Sharad
  • 3,562
  • 6
  • 37
  • 59
  • As you can see the query have a filter: `and cd.cd_language_id = 3`. I think that in this case the data stored (in DB) for different languages. The problem with getting ***REPORT_LOCALE*** for *JR Server* – Alex K Mar 19 '13 at 12:38