Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to make JIVE filtering/soring feature work on column in the table that contains expression


    akonkin
    • Features: JasperReports Server, User Interface Version: v6.0, v5.6.1

    To be short I would like to describe the possible design during which implementation you can encounter the behavior that may require usage of the property that I will share with you.

    Scenario:

    • The data in the Data Source that is expected bo be used in the report has the column with the type of Date in the databse

    • The report should be translated to different languages, and as we know each langage has its own representatiion(or pattern) according to which a field with the type of Date should be represented

    • To apply the dynamic formatting to the column with type of Date we can use Expression that I quote below:

    DateFormat.getDateInstance(DateFormat.SHORT,$P{REPORT_LOCALE}).format($F{customer_birthdate})
    

    complex_expression.png.a1cbb926f09ab237179327e133711e76.png

    This expression will help you to represent the column with type of Date with regards of Locale that is used during log in operation.

    However, if you try to activave JIVE sorting/filtering feature by clicking on the table header, you will find that soring/filtering buttons are inactive.

    JIVE_is_inactive.png.1741dfe9fe2b062a14366ca4c5033587.png

    Below I give you the explanation regarding this behavior that I've got from our engineering team and the possible workarounds:

    "It's not exactly a bug.

    The columns in the table that are neither sortable nor filterable contain complex formulas in their detail text field expressions. JIVE looks at the expression in the detail text field to understand what is the data source field or variable it needs to sort and filter after. When the text field uses a simple expression with only the name of a field or variable, things work smooth.

    Another approach is to [...] specify at column level in the table component, which is the field or variable to use for sorting and filtering, using one of the following two custom properties that can be set in the column tag/object:

    net.sf.jasperreports.components.table.column.field
    net.sf.jasperreports.components.table.column.variable
    
    

    ...

    In this case, setting the net.sf.jasperreports.components.table.column.field property to customer_birthdate at the column level should do."

    case_56946_configuration_of_column_that_contains_complex_expression.png.70487666288f19eaf5987bceacc311ab.png

    I have attached a sample of the report that I used in this article (Foodmart Database/PostgreSQL).

     

    Best regards,

    Alex

     

     

    complex_expression.png.3e4247d507ac65be4d947bad441c6ffe.png

    case_56946_configuration_of_column_that_contains_complex_expression.png.26c126c1ceb1e0d150535eedbad5bbc8.png

    case_56946.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...