Search code examples
jasper-reportsireport

Condition expression - how to get REPORT TYPE in condition Expression


I would like to write expression like this:

{REPORT_TYPE} == "csv" ? "'" + $F{NUMBER_VALUE} : $F{NUMBER_VALUE}

where {REPORT_TYPE} should be xls, csv etc.

Have you any idea how to get report type?


Solution

  • You need to send a parameter from your server which will get these type of format like csv,xls. If this parameter has some value then you can use this expression. e.g. you have a parameter named reportType then you can make a syntax like this.

    $P{reportType} ? "'" + $F{NUMBER_VALUE} : $F{NUMBER_VALUE}
    

    if you want report type like csv then you need to give a value to this parameter, otherwise send it as blank string.

    If you still get problem let me know.