How do I set the language of Input Control?

Ok so here is my Input Control

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 Highlighted Red
Language Id's
2 = Afrikaans
3 =English

Now as you can see, the Query is hardcoded 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 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 ?


andre.erasmus's picture
Joined: Mar 19 2013 - 2:33am
Last seen: 6 years 9 months ago
Hi Andre, Here a resolution for your issue: Create a parameter say locale in ireport and its default value expression as $P{REPORT_LOCALE}.getDisplayLanguage().equals("English") ? new Integer(3): new Integer(2), now use this parameter $P{locale} within the where clause of query. Now to make this work in Course Group input control: Create a single value input control (visible=false)with its ID as locale. Now use this parameter $P{locale} within the where clause of Course Group input control query. Tested and its working. Regards, Srikanth Kattam
Srikanth Kattam - 9 years 8 months ago

0 Answers:

No answers yet