Virtual Columns

From ADempiere
Revision as of 02:40, 3 April 2007 by Kthiemann (Talk) (what are virtual columns and how to use them)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

What and why?

Virtual columns are Adempiere table columns that are not part of the corresponding database table. Their values are not stored but calculated from an SQL expression.

They can be used to show additional fields from a referenced table (e.g to show name and the search key of a product in the shipment line) or to calculate a value from other table columns (eg. Age of the datarow as Updated-Created).


How?

Create the virtual Column

  1. Login as System Administrator
  2. Go to Application Dictionary -> Table and Column
  3. Select a table (e.g. M_InOutLine) and switch to the tab 'Column'
  4. Create a new column:
  • Name: Value
  • DB Column Name: Value
  • System Element: Value
  • Length: 40
  • Reference: String
  • Column SQL: (SELECT Value FROM M_Product p WHERE p.M_Product_ID=M_InOutLine.M_Product_ID)
  • Updateble: false

Add the new virtual column to the window/tab

  1. Go to Application Dictionary -> Window, Tab & Field
  2. Select the Shipment (Customer) window and switch to tab 'Tab'
  3. Select 'Shipment Line' and switch to tab 'Field'
  4. Create a new Field:
  • Name: Value
  • Column: Value_Search Key
  • Display Length: 14
  • Read Only: true