Jump to content
Changes to the Jaspersoft community edition download ×

Feature Request: pass map into subreport


Recommended Posts

By: Henri Chen - henrichen

Feature Request: pass map into subreport

2002-06-07 02:49

Hi,

 

The current tags allows passing a dataSource into subreport with <dataSourceExpression>. But the parameters must be passed ONE BY ONE thru the <subreportParameterExpression>. Do you considering add a tag, e.g. <subreportParameterMapExpression>, to pass the whole parameters map into the subreport (so I don't have to type them one by one again, :))

 

Just a suggestion.

 

Henri

 

 

 

By: Teodor Danciu - teodord

RE: Feature Request: pass map into subreport

2002-06-07 07:54

 

Hi,

 

JasperReports does not keep the parameter

map supplied to the report.

It takes what it needs and forgets about it.

 

If you would want to pass a map to the subreport,

you would have to build it yourself maybe using

scriptlets.

So, instead of writing the XML, you would write

code in the scriptlet class.

 

I'll give it a thought and come up with something.

 

Thank you,

Teodor

 

 

 

By: Henri Chen - henrichen

RE: Feature Request: pass map into subreport

2002-06-10 19:41

Hi, Teodor,

 

I have written some codes that would enable passing the whole Map into subreport and tested it on the demo program "supreport". It works! I wonder if you want to take a look of it. I would like to contribute it back if you say ok. (And please tell me how. diff?) The code is based on release 0.31.

 

The logic: If you can pass Connection and Datasouce down to the subreport, then there is no reason that we cannot pass the whole Map down to the subreport. Just follow the same path.

 

I grep all "dataSourceExpression" and add all these codes regarding "parametersMapExpression", the tag I invented for <subreport>.

 

The key is that the parameter Map itself can be used to pass a parameter Map(can be itself or another subreport specific Map). I also added a default Parameter, REPORT_PARAMS_MAP (just like REPORT_DATASOURCE) , to represent the passed in paremeter Map.

 

Ok, that is all.

 

Henri

 

 

 

By: Henri Chen - henrichen

RE: Feature Request: pass map into subreport

2002-06-10 19:52

One more thing about my code.

 

When doing filling, if the parameter key name is the same for subreportParameter and for one entry in the passed in Map, the subreportParameter would take precedence. Something like a overriding concept. But I am not sure which should overide which, so I just picked one.

 

Henri

 

 

 

By: Teodor Danciu - teodord

RE2: Feature Request: pass map into subreport

2002-06-11 01:24

 

Hi,

 

I'll be glad to see your code and eventually have

it integrated into the main version.

 

Thank you,

Teodor

 

 

 

By: Henri Chen - henrichen

RE: RE2: Feature Request: pass map into subreport

2002-06-11 02:56

How do I send my codes and in what form?

 

To the patch area and use diff -u?

 

Henri

 

 

By: Teodor Danciu - teodord

RE3: Feature Request: pass map into subreport

2002-06-11 03:35

 

Hi,

 

You could send me all the files affected by the

modification by email: teodord@hotmail.com

 

Since you already told me how you implemented it,

I think I'll be able to do the same.

 

Thank you,

Teodor

 

 

 

By: Henri Chen - henrichen

RE: RE3: Feature Request: pass map into subreport

2002-06-11 20:00

The files sent.

 

Henri

 

 

By: Teodor Danciu - teodord

RE4: Feature Request: pass map into subreport

2002-06-12 04:23

 

Hi, Henri,

 

I have introduces the parametersMapExpression

feature in the new 0.3.2 version.

 

Then I saw how you managed to avoid the

overriding of the parameters map by the subreport

parameters.

 

I chose to do nothing special about that.

If you pass directly the REPORT_PARAMETERS_MAP

to your subreport, the map will be affected.

For example, the REPORT_DATASOURCE will be

replaced by the data source of the subreport.

It won't affect the main report, but will affect those

elements that will use the map after that.

 

However, if you want to preserve your map,

you can pass it to the subreport like this:

 

<parametersMapExpression>new HashMap($P{REPORT_PARAMETERS_MAP})</parametersMapExpression>

 

We could do this for everybody in the JRFillSubreport,

but those who will want to have the map overridden

wont be able to use it that way.

 

Thank you,

Teodor

 

 

 

By: Henri Chen - henrichen

RE: RE4: Feature Request: pass map into subreport

2002-06-12 07:38

Hi, Teodor,

 

Yes, your design is better and much more flexible. Besides, the user also gets the extra benifits to choose the wrapping Map he likes (if he wants to).

 

Good tool! The hyperlink support just come in time for me. Thank you very much.

 

I am writing Ant task to compile JasperReports design. When I am done, I will pass that to you.

 

Henri

 

 

 

By: Dan Peery - sfpeery

RE: RE4: Feature Request: pass map into subreport

2002-12-20 10:40

Instead of passing the map to subreport, is there a way to pass the datasource / collection?

 

Explanation: I have a report that only has one record. I passed the data as a collection instead of a map. I did not use a map because the collection was already coming from someone else.

 

 

 

By: Teodor Danciu - teodord

RE: RE4: Feature Request: pass map into subreport

2002-12-22 23:55

 

Hi,

 

Not sure I understand what is the content of

your collection and how are you planning to use it.

Are you talking about the data source of the report

as a collection, or about subreport parameter values

supplied as a collection istead of a map?

 

Thank you,

Teodor

 

 

 

By: Dan Peery - sfpeery

RE: Feature Request: pass map into subreport

2002-12-23 16:10

I have solved my problem.

 

I was talking about wrapping the same collection used for the main report in a JRBeanCollectionDataSource instead of using the map for each subreport needing the same data as the main report.

 

Currently, I am mainly dealing with 1 record reports. I have been passing that 1 record to the report in a map or in a JRBeanCollectionDataSource/Vector.

 

I solved my problem by passing the same collection wrapped in a new JRBeanCollectionDataSource for each subreport as a parameter in the map.

 

This allows me to hide blocks of report output on the main report using subreports and the <printWhenExpression>.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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