Jump to content
JasperReports Library 7.0 is now available ×

Recommended Posts

Ok so here is my Input Control

inputcontrole(1).png.d668e2c20b52dbfd31b1e00659053ebf.png

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 ?

 

Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...