Jump to content

database and table mapping


Go to solution Solved by Otto Hahn,

Recommended Posts

Posted

How to change the database and table names in a report or subreport in my code?
Examples:

SELECT DISTINCT "DB20154"."REGISTER_TABLE"."VAL_FFIELD"FROM "DB20154"."REGISTER_TABLE"[/code]

change to

SELECT DISTINCT "DB20116"."REGISTER_TABLE"."VAL_FFIELD"FROM "DB20116"."REGISTER_TABLE"[/code]

or

SELECT DISTINCT "DB_DEVELOPER"."T_123456789"."VAL_FFIELD"FROM "DB_DEVELOPER"."T_123456789"[/code]

 

SELECT DISTINCT "DB_CUSTOMER"."T_163258984"."VAL_FFIELD"FROM "DB_CUSTOMER"."T_163258984"[/code]

 

 

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

There could be a mian query which can be changed using the db sign on top or look for the dataset name and change the query.

I suggest you go through the Document provided to you along with the setup.
Regards,
KKriplani

Posted

JasperReport jasperReport = JasperCompileManager.compileReport(reportFilePath.getAbsolutePath());JRDataset dataset = jasperReport.getMainDataset();JRQuery query = dataset.getQuery();for (JRQueryChunk chunk : query.getChunks()) {    System.out.println(chunk.getText());}[/code]

In this context it's not possible to change anything.

My goal only would be to replace the db- and the tablenanme.

  • Solution
Posted

Thank you hozawa,

change from

SELECT DISTINCT "DB_DEVELOPER"."T_123456789"."VAL_FFIELD"FROM "DB_DEVELOPER"."T_123456789"[/code]

to

SELECT DISTINCT VAL_FFIELDFROM "$P!{DB}"."$P!{TABLE}"[/code]

The SQL statement now is dynamic. http://community.jaspersoft.com/sites/all/libraries/ckeditor/plugins/smiley/images/thumbs_up.gif

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...