In Lesson 2 of the Jasperreport lessons we find the following text:
"There are different ways to obtain the information, such as from the database or directly from the view where the action is called. We will choose the first option".
Is it possible to provide the code to generate a report that contains some of the fields that are shown on the detail page which shows the action which calls the report.?
(in stead of querying the fields from the database).
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the lesson 2 you learn how to use parameters to send data to the report. You can fill the data from any place you want. In the example, it gets the data from the entity, but you can get the data from the view with the same effect.
That is, instead of getProduct().getXxx() use getView().getValue("xxx"). The caveat of this approach is that the filed must be displayed in the view. That is if you do:
getView().getValue("product.isbn"):
But product.isbn is not displayed, the isbn will not be populated, while using :
getProduct().getIsbn();
It will be populated even if not displayed.
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Lesson 2 of the Jasperreport lessons we find the following text:
"There are different ways to obtain the information, such as from the database or directly from the view where the action is called. We will choose the first option".
Is it possible to provide the code to generate a report that contains some of the fields that are shown on the detail page which shows the action which calls the report.?
(in stead of querying the fields from the database).
Thanks in advance.
Hi Frank:
In the lesson 2 you learn how to use parameters to send data to the report. You can fill the data from any place you want. In the example, it gets the data from the entity, but you can get the data from the view with the same effect.
That is, in the action code change:
By:
That is, instead of getProduct().getXxx() use getView().getValue("xxx"). The caveat of this approach is that the filed must be displayed in the view. That is if you do:
But product.isbn is not displayed, the isbn will not be populated, while using :
It will be populated even if not displayed.
Help others in this forum as I help you.