1.3.4 Data Macros

AXL Data Macros represent data validation logic, product logic and business logic in a data application.  Data Macros allow a data application to perform a series of actions based on a given set of conditions.  They can exist in a list as a standalone named object, or be associated with an event in a list.

An example of validation logic is the use of a Data Macro to ensure that a value entered into a field makes sense given other values in the list. After a value is entered into the EndDate field of a record, a Data Macro can be triggered to ensure that the value of that field is later than the value of the StartDate field in the same record, or else the record will not be updated.

Another example is the use of a Data Macro to keep the value of a field in one list updated based on entries in another list. When a new item is created in a Projects table, a Data Macro can be triggered to increment the TotalProjectCount field in the separate Managers table, so that each record in the Managers table has an up-to-date count of the total number of projects assigned to that manager.

Data Macros are specified by the CT_DataMacro type (section 2.2.3.49). All Data Macros can specify a Statements child element which specifies the commands that will be performed when the Macro is called. Data Macros associated with a list event specify the Event attribute, which specifies when the Macro will be triggered, whereas named Data Macros specify the Name attribute. Named data macros can also specified a Parameters child element which specifies the names and values of passed-in parameters.