Jump to content
We've recently updated our Privacy Statement, available here ×
  • Using attributes in a domain's derived table


    ghudson_1

    Issue Description

    In 6.1.x you can parameterize a derived table of a domain via 6.x attributes defined within user profile, tenant or server-wide level

    Resolution

    Following is a sequence for passing an attribute from a user's profile into a derived table. Derived tables basically insert their query "inline" into the greater sql query generated by the domain semantic layer of code in JasperReports Server:

    1. Created a user attribute named myCity, value Raleigh.  Per the guide, the syntax for accessing this value would be {attribute('myCity','User')}

    2. Created derived table with a query containing your attribute syntax:

    select * from orders where shipcity != '{attribute('myCity','User')}' Note the single-quotes due to postgres syntax.  Add the shipcountry field and any other fields derived table to the display tab of the domain and save.

    3. Create a new Ad Hoc View from the domain, include the derived table and drag the shipcountry field into the pane.  The action results in this query seen via the Ad Hoc View Query or cache:

    select "shipcountry"
    from (select * from orders where shipcity != 'Raleigh') "query"
    group by "shipcountry"
    order by "shipcountry"
     limit 1000 
     

    For management of attributes see the Administrator Guide. 


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...