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

Reference fields from custom datasets


denzildsouza555

Recommended Posts

Hello,

I need to execute multiple queries and compare their results at the end.

I made multiple datasets in my report for it with the different queries.

But I am unable to use the fields in my report.

for instance I have a dataset created orders what has a field order_id. I try to use this field by using $F{orders.order_id}. I report doesn't recognize this.

Appreciate any assistance.

Thanks.

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
 

Link to comment
Share on other sites

I think your syntax is wrong. $F{orders.order_id} looks for a field called "orders.order_id". When you pass a Datasource to a (Sub-)Report, you have to create a field called "order_id" and call $F{order_id}. Jasperreports gets the data by calling

public Object getFieldValue(JRField jrField) throws JRException from JRDataSource

Link to comment
Share on other sites

In studio, you cannot use a dataset fields directly into the main report. You can use Dataset fields,  if your main report has a list, table or sub-reports.  If you want to compare the results of datasets. There are two ways. 

1. writing a scriptlet 

2. Handling at the query itself.

3. using return variables from each dataset element and compare the values.

Hope this help you.

Link to comment
Share on other sites

Hello rpachipu,

Thanks for your explanation.

The main issue that I face is that my dataset queries that I use to execute and print data in tables have parameters to be passed which I am taking from the main report.

How can I reference those parameters while executing the query for my table dataset ?

Thanks.

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