Commands, Macros, and Expressions

You can use macros and expressions within commands. When defining commands you can use macros and expressions to pass data to the commands.

This page discusses:

Commands

Commands can be used in any kind of menu in a JSP application. Commands might or might not contain code, but they always indicate how to generate another Web page. Commands are child objects of menus—commands are created first and then added to menu definitions, similar to the association between types and attributes. Changes made in any definition are instantly available to the applications that use it.

Commands can be role-based, that is, only shown to particular users. For example, a number of commands might only be available when a person is logged in as a user defined as Administrator. When no users are specified in the command definitions, they are globally available to all users.

For more information, see MQL Command Reference: command Command.

Using Macros and Expressions in Configurable Components

Many strings used in the definition of configurable components (such as label values, hrefs, and settings) can contain embedded macros and select clauses. The ${} delimiters identify macro names. Macros are evaluated at runtime. Macros for configurable components are available for directory specification. Some existing macros are also supported.

Some strings can also include select clauses which are evaluated against the appropriate business object at run-time. The $<> delimiters identify select clauses. Because the select clauses will generally use symbolic names, the clauses will be pre-processed to perform any substitutions before submitting for evaluation. The following example shows a macro being used in the href definition and another macro being used in the Image setting, as well as a select clause being used in the label definition of a tree menu (associated with a LineItem object):

MQL<2>print menu type_LineItem;
menu type_LineItem
  description
  label '$<attribute[attribute_EnteredName].value>'
  href '${SUITE_DIR}/emxQuoteLineItemDetailsFS.jsp'
  setting Image value ${COMMON_DIR}/iconSmallRFQLineItem.gif
  setting Registered Suite value SupplierCentralSourcing
  children
    command SCSAttachment
    command SCSAttributeGroup
    command SCSHistory
    command SCSSupplierExclusion
    command SCSUDA
		nothidden
  property original name value type_LineItem
  property installed date value 02-28-2002
  property installer value MatrixOneEngineering
  property version value Verdi-0-0-0
  property application value Sourcing
  created Thu Feb 28, 2002 11:12:34 AM EST
  modified Thu Feb 28, 2002 11:12:34 AM EST

The following example shows a typical business object macro being used in the label definition of a tree menu (associated with a Company object):

MQL<3>print menu type_Company;
menu type_Company
  description
  label '${NAME}'
  href '${SUITE_DIR}/emxTeamCompanyDetailsFS.jsp'
  setting Image value ${COMMON_DIR}/iconSmallOrganization.gif
  setting Registered Suite value TeamCentral
  children
    command TMCBusinessUnit
    command TMCLocation
    command TMCPeople
  nothidden
  property original name value type_Company
  property installed date value 02-28-2002
  property installer value MatrixOneEngineering
  property version value Verdi-0-0-0
  property application value TeamCentral
  created Thu Feb 28, 2002 11:31:57 AM EST
  modified Thu Feb 28, 2002 11:31:57 AM EST

When using a macro, surround it with quotes to ensure proper substitution if a value contains spaces.

Supported Macros and Selects

You can use the listed directory and select expression macros used in the configuration parameters of administrative menu and command objects. These menu and command objects are used for configuring the menus/trees in the apps that use them. These are the only macros currently supported for use in any dynamic UI component.

Directory Macros

The following table provides the list of directory specific macros used in the configuration setting.

Directory Macros
Macro Name Description
${COMMON_DIR} To substitute the "common" directory below "ematrix" directory. The substitution is done with reference to any application specific directory and it is relative to the current directory.
${ROOT_DIR} To substitute the "ematrix" directory. The substitution is done with reference to any application specific directory below "ematrix" and it is relative to the current directory.
${SUITE_DIR} The macro to substitute the application specific directory below "ematrix" directory. The substitution is done based on the "Suite" to which the command belongs. and it is relative to the current directory.

Select Expression Macros

Select expression macros are defined as $<SELECT EXPRESSION>, where the select expression can be any valid MQL select command. Select expression macros can be used in labels for configurable components and in expression parameters. These expressions are evaluated at runtime against the current business object ID and relationship ID that is passed in. Some examples include:

  • $<TYPE>
  • $<NAME>
  • $<REVISION>
  • $<attribute[attribute_Originator].value>
  • $<attribute[FindNumber].value>
  • $<from[relationship_EBOM].to.name>