Search code examples
eclipsedateparametersbirt

Birt Report Multiple Parameters for the same field


I am using Birt to generate reports. I want to use the same parameter twice in my where clause e.g. where date_column >= ? and date_column < ?. The '?' at this line is one parameter which points to a date (Report parameter). Adding to this in my next where clause I want to use a second parameter to find the date period again but in a different year (current year -1). I know that birt sees parameters and ? sequentially. How can I configure this?


Solution

  • Simply add two parameters with 2 diffenrent names to your query and use the same source(Report-Paramter) for both of your parameters. There is no restriction, that you cannot add the same paramter multiple times to your query.

    Add as many ? in your SQL query as you need parameters:

    SQL query with parameters

    In the Parameters Tag you can link them to your Report-Input-Parameters as you like and also add a Input-Parameter twice. The ? in your query will be replaces by the values of your parameters in the order of appereance (first ? = first parameter, second ? = second parameter etc.):

    add parameters to sql query