Jump to content
We've recently updated our Privacy Statement, available here ×

Issues printing SQL query results in different text fields


ruplex

Recommended Posts

Hi, good morning.

I'm having an issue when printing a SQL query result in different text fields on a report.

I'll explain what happens:

The SQL query returns the following information (data is approximate):

IDTOTALSUMPERCENTAGE_TOTALPERCENTAGE_SUM
1115630008064
22298059
33278058
44285059
552990510

This SQL query takes information from different tables, so there are inner joins in the query.

The text fields on the report are located in different parts, so I can't use the table element to present all the data. The text fields have the following expressions (where X is the ID number):

- ($F{ID}.intValue()==X)?$F{PERCENTAGE_TOTAL}:""

- ($F{ID}.intValue()==X)?$F{TOTAL}:""

- ($F{ID}.intValue()==X)?$F{PERCENTAGE_SUM}:""

- ($F{ID}.intValue()==X)?$F{SUM}:""

This means that I have 4 text fields for each ID in my report.

When I generate the report, I only see data for the first ID (11), but I can't see data for the other IDs.

Does anybody knows why the information from the other IDs isn't being represented on the report?

Hope someone can help me, and I hope my information is clear enough. If it isn't, I can explain better, if you need clarification.

I'm using Jaspersoft Studio 6.6.0 plugin for Eclipse, downloaded from Eclipse Marketplace.

Thanks in advance for the help.

Regards,

José

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

After an extensive search, I found out that the fields for the IDs different than 11, are also being set to use the ID = 11.

For example, I have this expression, ($F{ID}.intValue()==22)?$F{PERCENTAGE_TOTAL}:"". I kept getting a blank field for this text field. Once I set the expression as this, ($F{ID}.intValue()==22)?$F{PERCENTAGE_TOTAL}:$F{ID}.intValue(), I saw that the value being used is 11. That's why I was always getting blank fields.

Now, my question is this: does anyone knows how to make the other fields use the value assigned to?

Regards,

José

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