Jump to content

Parameter value(input control)


malang

Recommended Posts

Hi,

 

I'm having problems with parameters(input controls) in Jasperserver. I have succefully added a "Report Query" in iReport with the following query:

Code:

select * from pku where pku_kundnr=$P!{kundnr}

Where kundnr is a parameter in iReport. How do I add this to JasperServer?

 

/Martin

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

How to you added the Report (jrxml) to Jasper Intelligence(JI)? is using the JI + iReport plugin?

 

Basically, you need to create the input field and set the name of the field match to the parameter.

 

If you add a report in JI called report unit, there is a option to add the input (input control).

Link to comment
Share on other sites

  • 2 years later...

Hi,

 

select  *  from customer where $P!{WhereClause} order by customer, city

 

This is my query with parameter name WhereClause.

How do i filter the report on customer & city .......

customer & city are optional parameters, i have added only WhereClause parameter in iReport........

If i publish the report in Jasperserver, how can i add customer & city parameters.....

 

WhereClause  default value is 1=1, 

Query is :

select  *  from customer where 1=1 order by customer, city

 

I want the query like: (Optional values)

 

select  *  from customer where customer='aa' and city='X' order by customer, city

 

Link to comment
Share on other sites

Hi,

    Define 4 parameters, 2 each for the customer and city

Parameters - make customer_where and city_where invisible, while defining input controls. Define customer and city parameters as visible input controls in JasperServer for the user to select values.

Note: This solution cannot take care of "where 1=1" filter

1. customer

    <parameter name="customer" isForPrompting="true" class="java.lang.String">

2. customer_where

     <parameter name="customer_where" isForPrompting="false" class="java.lang.String">

      <defaultValueExpression><![CDATA["customer=$P{customer}"]></defaultValueExpression>

    </parameter>

3. city

      <parameter name="city" isForPrompting="true" class="java.lang.String">

4. city_where

       <parameter name="city_where" isForPrompting="false" class="java.lang.String">

       <defaultValueExpression><![CDATA["and city=$P{city}"]></defaultValueExpression>

      </parameter>

 

Finally have your query as

select  *  from customer where

$P!{customer_where}

$P{city_where}

order by customer, city

 

Hope this will help.

Ram

Link to comment
Share on other sites

Hi,


Got the solution...............

Single JRXML query can be filter based on WhereClause Values........

For the below query...........

select  monitor_name, customer_name, server_name, monitor_type
from Monitor
where $P!{WhereClause}
order by customer_name, server_name


http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Test/i

ncd&standAlone=true&ParentFolderUri=/reports/Test&WhereClause=customer_name='abc' and

server_name='Ser1'


The JRXML file i have added only one parameter WhereClause and the default value is 1=1........

If you are publishing the jrxml file, add input control(parameter name) as WhereClause, Type as

single value  and locally defined & data type name as WhereClause, Type as

Text/number/date/datetime.

Finally in URL you can pass any parameters.............

Filter the data  by passing dynamic fields to WherClause

Type 1:

customer_name, & server_name

WhereClause=customer_name='abc' and server_name='Ser1'

http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Test/i

ncd&standAlone=true&ParentFolderUri=/reports/Test&WhereClause=customer_name='abc' and

server_name='Ser1'



Type 2:

monitor_name and monitor_type

WhereClause=monitor_name='mn1' and monitor_type='mt'

http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Test/i

ncd&standAlone=true&ParentFolderUri=/reports/Test&WhereClause=monitor_name='mn1' and

monitor_type='mt'


Type 3:


monitor_id and monitor_place

WhereClause=monitor_id='mid1' and monitor_place='mp'

http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Test/i

ncd&standAlone=true&ParentFolderUri=/reports/Test&WhereClause=monitor_id='mid1' and

monitor_place='mp'





Filter the Records
Just add the

& WhereClause=monitor_id='mid1' and monitor_place='mp' at the end of your URL..........

 

Donot Filter(All Records)

If you want to display all values without filtering the data, default vaue expression for WhereClause is 1=1


Your URL will be without WhereClause

http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Test/i

ncd&standAlone=true&ParentFolderUri=/reports/Test



Post Edited by pentaho pentaho at 02/12/09 07:58
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...