Skip to main content

Use iDempiere Display/Reference Type In Jasper Report

Goal: Development

Developer: Hengsin (talk)

Feature Ticket: IDEMPIERE-4868 IDEMPIERE-6048

Description: Allow the use of iDempiere's Display/Reference Type based rendering of data in Jasper Report.

Usage:

  1. Pass COLUMN_LOOKUP parameter of type java.util.function.BiFunction to Jasper Report.
  2. To use it, you have to add a report parameter to your Jasper Report that's with the name and type above.
  3. In your field expression, you will then use expression of the format $P{COLUMN_LOOKUP}.apply("Display Type", Value).
  4. Value is usually a field reference (for e.g $F{C_DocType_ID}) but you can also use a string or number literal.
  5. "Display Type" can be one of the following:
    1. "TableName.ColumnName" - Get Display/Reference type from AD_Column (AD_Reference_ID and AD_Reference_Value_ID)
    2. Supported Type: Search, Table, TableDir, List, ChosenMultipleSelectionList, ChosenMultipleSelectionSearch, ChosenMultipleSelectionTable, Location, Image, YesNo, Account, Locator and PAttribute.
    3. In Release-10-2023-06-28 was added support for types Date and Numeric
    4. "location" - Address from C_Location.
    5. "account" - Description from Account Combination (C_ValidCombination)
    6. "locator" - Value from C_Locator
    7. "asi" - Description from M_AttributeSetInstance
    8. "AmtInWords" - Translate numeric Value to Wordings (i.e Msg.getAmtInWords)
    9. "Image" - get Image from AD_Image
    10. "YesNo"
    11. "chart/width/height" - width and height is numeric value for expected width and height in pixel. This render chart from AD_Chart as image.
    12. "attachment/table name/index" - index is index of attachment item (zero base). This get attachment item content as byte array (byte[]). NOTE: added on release-11-20240315
    13. "attachment/table name/file name" - file name can be exact or wildcard (*) matching of attachment item's file name (case sensitive). This get attachment item content as byte array (byte[]). NOTE: added on release-11-20240315

Example:

  1. $P{COLUMN_LOOKUP}.apply( "c_order.c_bpartner_id", $F{c_bpartner_id} )
  2. $P{COLUMN_LOOKUP}.apply( "location", $F{ship_c_location_id} )
  3. $P{COLUMN_LOOKUP}.apply("c_bpartner_location.c_location_id",$F{c_location_id})
  4. $P{COLUMN_LOOKUP}.apply("c_bpartner.invoicerule",$F{invoicerule})
  5. $P{COLUMN_LOOKUP}.apply( "yesno", $F{isbillto} )
  6. $P{COLUMN_LOOKUP}.apply( "chart/600/400", 50002)
  7. $P{COLUMN_LOOKUP}.apply( "attachment/test/0", 103)
  8. $P{COLUMN_LOOKUP}.apply( "attachment/test/emoji*.png", 103)

Update: :IDEMPIERE-6048 added support for attachment ("attachment/table name/index" or "attachment/table name/file name").


Source: Wiki