Jump to content

Multiple query's mongodb - Jasper reports


thegametimemachine

Recommended Posts

I have a small app that handles inventory for projects. The database I am using is Mongodb. In one collection I have the following fields.

_id

product_code

price

qty

location

project <-- ObjectId(Holds a specific projects _id)

 

The project schema has the following fields:

_id

project_num

project_name

manager

active

The report that I have now generates all of the inventory based on the first collection. Only problem now is that I would like to have the project number, name and manager on the report page header aswell.

I was thinking about creating a dataset with a query to the projects collection using the projects field from the main report, but I have no where to start and I cant just use $F{project} in the query..doesnt work. If someone has some time to help me it would be greatly appreciated..

 

Thank you

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

HI,

 

You can creat a subreport and place some where in the main report and make it hidden with some label box or something.

Pass the variable F{Project} to subreport and using this id retireve project_num, name and manager.

Then return this three into three other varibale declared in main report. Display it in the title. I think this will work.

Let me know.

 

Thanks

Hisham.A

Link to comment
Share on other sites

You can easily pass the parameters to the subreports from the main report and viceversa .

For this you can go to the properties of the subreport and there in the end you can find Parameters. Now in here you can click add and specify the name of the parameter of the subreport which would recieve the value from the main report , basically you need to map the parameters of subreports and the main report.

 

If you want to pass the data from the subreport to the main report then you need to specify the Return values in the properties of the subreport and do the same mapping there.

 

Look at this tutorial http://community.jaspersoft.com/wiki/subreports-jaspersoft-studio#Creation_of_the_First_Subreport

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