The following steps need to be applied to BIRT reports if they need to be run on DB2 databases for both ZOS and non-ZOS platforms.
if(params["db2numbertype"].value == "bitdata") { mytable = reportContext.getDesignHandle(). findElement("<ENTER CHART NAME HERE>"); mytable.setProperty( "dataSet", "zos" ); }
importPackage(Packages.java.math); importPackage( Packages.biapp ); var param_<append parameter name here> = BigDecimal.valueOf (params["<ENTER Parameter name here>"].value); param_<append parameter name here>_long_to_string = UniqueIDUtil.longToString (param_<append parameter name here>); this.queryText = " <Enter the SQL select statement here>"
Note: The parameter name is case sensitive. You must enter it as it appears in the report.
E.g. The following is an example of a completed code section. You will need to create the relevant parameters based on the query given. In this example there is only 1 parameter called 'concernRoleID', this parameter is passed in to the report and then it is converted to be used in the SQL query as follows:
importPackage(Packages.java.math); importPackage( Packages.biapp ); var param_concernroleid = BigDecimal.valueOf(params["concernRoleID"] .value); param_concernroleid_long_to_string = UniqueIDUtil.longToString (param_concernroleid); this.queryText = "SELECT numberPermanentStaff as numberStaff" + ", 'PermanentStaff' as staffType" + " FROM Employer" + " WHERE concernRoleID =" + param_concernroleid_long_to_string + " UNION" + " SELECT" + " numberCasualStaff as numberStaff," + " 'CasualStaff' as staffType" + " FROM Employer" + " WHERE concernRoleID =" + param_concernroleid_long_to_string