Jump to content
JasperReports Library 7.0 is now available ×

providing BeanSource with user parameters


2006 IR Open Dicussion

Recommended Posts

By: GGShinobi - ggshinobi

providing BeanSource with user parameters

2006-03-23 09:29

Hi there,

 

when using iReport with a JDBC connection, I can use parameters filled by the user ("is for prompting"-parameters) to limit the scope of the result that the sql-query returns. Here is an example of this for better understanding:

 

SELECT *

FROM myTable

WHERE

$P!{SelectRestriction}

name like '*Blub*'

AND age < 99

 

Where the value of the Parameter "SelectRestriction" is passed by the user because it's for prompting. When running this report, the user could restrict the returned data from the sql-query by example to data that only contains the street "Jasper-Street" by entering "street = 'Jasper-Street' AND" as the parameter.

 

Now I'm looking for a way to get that same functionality when using the iReport with Beans as a datasource. I want to pass the "is for prompting"-Parameters to the Bean-Source, so that the source can restrict the returned data to the report, depending on the passed parameters. But I don't know how I can access the paramters!

 

For example, I used the JRAbstractBeanDataSourceProvider, and tried to access the parameters via the JasperReport "report" that is passed when calling the "create"-method. I used the report.getParameters()-method to get the parameters, but all the parameters inside the returned array where JRBaseParameters. And I found no way of getting the value from a JRBaseParameter.

So, I tried to access the REPORT_PARAMETERS_MAP directly, but I found no way to reference it, because calling JRParameter.REPORT_PARAMETERS_MAP only returns a static string.

 

I think I have some fundamental misunderstanding, because I thought I would get the Map. Is there any way of getting the value of "is for prompting"-Parameters when using Beans, so that I can work with the parameter values inside my BeanProvider?

 

Thank you very much for any help

Christopher

 

 

 

 

By: Craig Butts - craigbutts

RE: providing BeanSource with user parameters

2006-05-02 14:43

Christopher,

I am trying to do this same thing - have you discovered a solution yet?

 

Thanks,

Craig...

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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