Subreporte y forzar nueva hoja.

0

Hola, agradezco alguna ayuda.

Me encunetro con que debo hacer un reporte de unos productos, 
estos productos se empacan en cajas pequeñas y estas cajas pequeñas se empacan en una caja mas grande.
el reporte lo estoy haciendo por colletions of javabeans.

Tengo ya generado un reporte, que me dice en la primera hoja, las caracteristicas de la caja GRANDE y que productos tiene en total.
ahora me encuentro con que en la segunda hoja, tercer hoja, 4ta hoja, etc.
debo mostrar cada caja pequeña con su contenido.
mi pregunta es:
¿Donde encuentro informacion para forzar una segunda hoja, tercer hoja, etc?
¿que debo investigar para unir estos reportes?

supongo yo que es alguna clase de subreporte, o una especie de grupo de reportes o seria hacer dos reportes, lo que seria muy facil para mi, pero debo al momento de generarlo, unirlos y que aparente uno solo. 
pero no puedo unir los pdfs, debo unir los reportes desde un principio, por que luego tendre que guardarlos en excel, por hojas.
muchas gracias, a quien pueda ayudarme.

actualmente tengo una clase general que tiene atributos de la caja, y un list<> con los productos que contiene. no se si podria crear otro list<> con las cajas medianas, pero este list<> deberia contener sus productos de cada caja mediana.
si esto se puede hacer, ¿donde puedo encontrar informacion al respecto,   ListCajasGrandes< ListCajasPequeñas < ListProductos<> > >  muchas gracias.

hernando.moran's picture
Joined: Feb 25 2020 - 4:41pm
Last seen: 5 months 1 week ago

Use English and screenshot to describe, please.

I am Leo - 7 months 2 days ago

Bueno regreso por aqui a contestarme a mi mismo:
1. Me creé un reporte con listado de productos por caja mayor... ok.
2. Me creé un segundo reporte con una organizacion por grupos para que me muestre cada contenido de caja en paginas diferentes.
 

Ahora tengo un reporte principal, el cual mediante subreportes agrego los dos reportes, paso los datos por parametros.
y los subreportes con cargan!
¿alguna idea?

hernando.moran - 7 months 1 day ago

Usa el inglés si puedes. Podemos luchar con el español si debemos hacerlo. Mi español te haría sangrar los oídos.

Use English if you can. We can struggle with Spanish if we must. My Spanish would make your ears bleed.

Question:

Hi, I appreciate some help.

I find that I have to make a report of some products,
These products are packed in small boxes and these small boxes are packed in a larger box.
I am doing the report by colletions of javabeans.

I have already generated a report, which tells me on the first sheet, the characteristics of the BIG box and what products it has in total.
Now I find that on the second sheet, third sheet, 4th sheet, etc.
I must show each small box with its contents.
my question is:
Where do I find information to force a second sheet, third sheet, etc?
What should I investigate to join these reports?

I suppose that it is some kind of subreport, or a kind of group of reports or it would be to make two reports, which would be very easy for me, but I must at the time of generating it, join them and that only one appears.
but I cannot join the pdfs, I must join the reports from the beginning, because then I will have to keep them in excel, by sheets.
Thank you very much to anyone who can help me.

I currently have a general class that has box attributes, and a list <> with the products it contains. I don't know if I could create another list <> with medium boxes, but this list <> should contain its products from each medium box.
If this can be done, where can I find information about it, ListCajasGrandes <ListCajasPequeñas <ListProductos <>>> thank you very much.

Comment:

Well I come back here to answer myself:
1. I created a report with a list of products by cashier ... ok.
2. I created a second report with an organization by groups to show me each box content on different pages.
 

Now I have a main report, which by subports I add the two reports, I pass the data by parameters.
and the subports with load!
any ideas?

djohnson53 - 7 months 1 day ago
show 1 more...

djohnson53,  thanks!

hernando.moran - 6 months 4 weeks ago

3 Answers:

0

Hello!, 
I have found part of the solution.
I have created two reports, one that creates a list of the products in the big box.
I have created another report separated by sheets, with the contents of each box. The solution was to pass the data and add a common field, "the small box" and display the information in groups. in separate sheets, every time you find a different box, something very simple to do with jasperReports.
Now I find that I have two reports and insert them into a general report. But both share the same data source.

When the first report consults the data, it is consumed, and there is no information left for the second report, so the second report is not printed.
I found a solution:

https://stackoverflow.com/questions/29943470/multiple-subreports-in-main-report-using-same-datasource

but I don't know how to integrate it into my code:
My code is as follows:
JasperPrint Order = JasperFillManager.fillReport (report, parameters,
new JRBeanCollectionDataSource (fillList)
I have a model class with the attributes to be printed, and a "fillList" method that returns a list of this class.

How can I integrate it to my method that returns me a list?

hernando.moran's picture
Joined: Feb 25 2020 - 4:41pm
Last seen: 5 months 1 week ago
1

Good that you worked out the page breaks.

The key point in the stackoverflow post is creating a new Data Source object in the dataSourceExpression.

You need to do something like: 

dataSourceExpression><![CDATA[new JRBeanCollectionDataSource (fillList))]]></dataSourceExpression>

swood_1's picture
2298
Joined: Nov 15 2012 - 10:47am
Last seen: 4 months 3 weeks ago
0

See also this similar approach: https://community.jaspersoft.com/wiki/how-cache-data-report-use-multiple... It's slightly more complex, but it caches the data, which might be convenient with many sub reports or datasets.

kkumlien's picture
3849
Joined: Jan 22 2015 - 4:36am
Last seen: 5 days 14 hours ago
Feedback
randomness