Jump to content
We've recently updated our Privacy Statement, available here ×
  • Example of advanced join syntax in Domains


    kkumlien
    • Features: Ad Hoc, Domains, JasperReports Server Version: v6.2, v6.1, v6.0 Product: JasperReports® Server

    Introduction

    The advanced join syntax is available in Domains since JasperReports Server 6.0, as described in the documentation chapter Representing Joins in XML.

    In this article we show a simple Domain in two sample configurations, one with basic syntax and then the same translated to the advanced syntax.

    Example

    This is based on the Foodmart sample database.

    Here's the join section from the design file with basic syntax (attached to this article):

        
          
    [...]
          
          
          
            
              join public_employee public_employee on (public_department.department_id == public_employee.department_id)
            
          
        
    

    Here's the same, translated to advanced syntax (also attached):

        
          
    [...]
          
          
          
            
          
          
            
            
          
        
    

    The specific rules and syntax are explained in detail in the documentation linked above.

    Caveats

    Since 6.2, this is explained in the documentation:

    When you add or modify joins in the Domain design file, make sure that all tables in a join element are actually connected. If you include a table that is not actually joined to any other tables, the unjoined table will be included in any Ad Hoc view that uses that data island. In this case, the fields in the unjoined table will show up in the Ad Hoc view. You will receive errors in your Ad Hoc view when you add unconnected fields from a poorly-configured join.

    This is a sample stack trace you might see when the above occurs – in this case with a PostgreSQL database:

    ERROR AdhocAjaxController,http-bio-8080-exec-1:926 - ad hoc controller exception: An error occurred while performing the previous request.
    java.lang.RuntimeException: exception getting dataset from cache
    [...]
    Caused by: org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "your_table_name"
    

     

    schema-basic.xml

    schema-advanced.xml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...