Context Logic

From iDempiere en

Context Logic Explained

Note, this page is work in progress, please feel free to contribute and help completing the documentation

There are many places within iDempiere where the application manages Context Logic and is difficult to keep track of all the possibilities of every field. This wiki page tries to collect the documentation about the fields and the possibilities of each logic.

Conditional Context Logic

Used in

Column Class
AD_Tab.DisplayLogic org.adempiere.impexp.GridTabCSVExporter.export
AD_InfoProcess.DisplayLogic org.adempiere.model.MInfoProcess.isDisplayed
AD_Column/AD_Field/AD_UserDef_Field.ReadOnlyLogic org.compiere.model.GridField.isEditable
AD_Process_Para.ReadOnlyLogic org.compiere.model.GridField.isEditablePara
AD_Tab.DisplayLogic org.compiere.model.GridTab.isDisplayed
org.adempiere.webui.adwindow.CompositeADTabbox.updateBreadCrumb / updateTabState
AD_Tab/AD_UserDef_Tab.ReadOnlyLogic org.compiere.model.GridTab.isReadOnly
AD_InfoColumn.DisplayLogic org.compiere.model.MInfoColumn.isDisplayed
AD_ZoomCondition.ZoomLogic org.compiere.model.MZoomCondition.findZoomWindowByTableId / findZoomWindowByTableId
AD_StyleLine.DisplayLogic org.adempiere.webui.adwindow.GridTabRowRenderer.applyFieldStyle
AD_ToolBarButton.DisplayLogic org.adempiere.webui.adwindow.ToolbarCustomButton.dynamicDisplay


format := {expression} [{logic} {expression}]
expression := @{context}@{operand}{value} or @{context}@{operand}{value}
logic := {|}|{&}
context := any global or window context
value := strings or numbers
logic operators := AND{&} or OR{|} with the previous result from left to right
operand := eq{=}, gt{>}, le{<}, not{~^!}

In other words, a conditional context logic is composed by one or several expressions (comparisons) processed from left to right with AND or OR operators, in this statement is important to note:

  • Expression: means a comparison between a context variable and a constant (also between two constants or two context variables)
  • Context variable can be:
Syntax Example Description
These variables starting with # are set at login time
Accounting variables (starting with $) also set at login time
This usually refers to a field in the current window (or another process parameter in the process dialog)
This refers to a field on the specified tab (tab numbering starts with zero)
When the variable starts with ~ that means a field in the CURRENT tab, do not look for fields in the other tabs
These are preferences, sometimes defined at login time, sometimes defined by the user
At the end of any of the variables described above, you can set a default to be set when the variable is null or it doesn't exist, the default is defined at the end of the variable after a colon :
This is a way to obtain and compare values from foreign tables, in the example it gets the Name from the table AD_Org for comparison.


  • In process parameters this syntax just works for columnnames where the tablename is implicit in the name (like Table Direct).
  • In Tab Display Logic this notation doesn't work
  • Note that when checking a context variable ending with _ID the null is replaced with a zero value
  • Constants are strings or numeric values, the constants don't need to be surrounded by quotes, but if they are surrounded by quotes they are properly managed
    • The constant empty string is defined as two quotes:
  • The expression then requires a comparison operator, these are:
    • Equals =
    • Greater than >
    • Less than <
    • Different ! or ^ or ~
  • Several expressions can be evaluated FROM LEFT TO RIGHT using AND or OR logical operators
    • the AND operator is &
    • the OR operator is |


Condition Description
This is evaluated always as false
@ElementType@=A & @IsSummary@=N & @IsDetailBPartner@=Y
If the field ElementType contains an A, and the flag IsSummary is unchecked, and the flag IsDetailBPartner is checked
When the field AD_Client_ID is greater than zero, this means false in System client, and true for all the other clients

SQL Context Logic

Logic based on a SQL query works like this:

  • no row returned means false
  • otherwise is true.

The SQL logic must start with @SQL= and it uses commonly context variables.

Preceding the query with a ! sign, this is, starting with @SQL=!, inverts the logic (no rows is true, otherwise false)


@SQL=!SELECT 1 FROM WS_WebService_Para WHERE WS_WebServiceType_ID = @WS_WebServiceType_ID:0@

Context Variables Replacement


Cookies help us deliver our services. By using our services, you agree to our use of cookies.