XMADL element: <action>

Actions are executed on the occurrence of events. A mobile application receives events as a result of user’s gesture like TAP or change in the state of the application for example, launching the app will trigger an event “ON_APP_LAUNCH” or displaying the new screen will trigger an event “ON_CREATE_SCREEN”. The app author attaches actions to these events. For example, an action could be

  • Save the data locally on the device or remotely to the server
  • Display the next screen
  • Fetch friends list from Facebook

It is defined by using the following XMADL tags.

<actions></actions>           Contains actions associated with a particular control,
                              screen or other actions.

<action/>                     Defines action properties. For Ex. an action NEXT_SCREEN
                              will display the next screen defined in its attribute
                              called target.

Action Attributes

Attributes Description Mandatory Values
action_name states the name of the action Yes eg: CALL_PHONE, NEXT_SCREEN
event_list defines the event name at which the action takes place Yes eg: TAP
target defines target screen or function that needs to be called No screen name, function name
input_parameter_list defines the parameters (variables) to be passed to the target No
comma separated list. Each parameter can be a
  • A constant value (CONSTANT:<value>) for ex. CONSTANT:3
  • A Global Property (GLOBAL:<property name> for ex. CONSTANT:home_url
  • Any field_name of the control present in the current screen.
  • A value from the database using SQL query.
  • Any parameter passed to the screen via action NEXT_SCREEN
  • Any parameter fetched from the remote_data_source (if one is present)
target_parameter_list defines the parameters (variables) to be received in the target. The parameter names can be different from input_parameter_list. No comma separated parameters. If input_parameter list is defined, and target_parameter_list is not, then by default input_parameter_list is copied to target_parameter_list
mark_deleted if mark_deleted = 1, the action will not be read in the app No default value = 0 (not deleted)

Attaching more than one action

The XMADL element <actions> ... </actions> can contain one or more actions. The actions can be peer actions or nested actions.

Peer Actions vs. Nested Actions

When all actions are at the same level, they are called peer actions. In the example below, action1 and action2 are peer actions. When an action contains a child actions, then they are called nested actions. In the example below, action2 and action2_1 are nested actions.

        <action name="action1" event_list="TAP" target="....">
        <action name="action2" event_list="TAP" target="....">
            <action name="action2_1"  event_list="TAP" target="...."/>

When the actions are nested, it is guaranteed that the child action will be executed only after its parent returns true. If the actions are peer actions, and the first action executes in background then second action can start executing in parallel with the first. If the peer actions do not invoke a background thread they are similar to nested actions that is the next peer action is executed after the first one is completed.

Passing data

Data can be passed from one action to the other or from one screen to the next screen using attributes input_parameter_list and target_parameter_list. Consider the following example. The code below shows when the tap event is received on the PUSHBUTTON,

  • Data is stored into a database table called user_details using the action EXECUTE_SQL.
  • Userprofile screen is shown using NEXT_SCREEN action. Data is passed to the next screen using the input_parameter_list.
  • Closes the current screen using action CLOSE_SCREEN.
<control name="savebutton" type="PUSHBUTTON" x="10" y="50" width="80" height="10"
         appearance_name="blue_button" data_type="VARCHAR" word_wrap="1" default_value="Save and display values in Profile" >
     <!-- attaching action to this control -->
        <action event_list="TAP" action_name="EXECUTE_SQL"
                target="insert into user_details(lastname, firstname, email, password)
                input_parameter_list="lastname, firstname, email, password" >
            <action event_list="TAP" action_name="NEXT_SCREEN" target="userprofile"
                    input_parameter_list="lastname, firstname, email, password">
                <action event_list="TAP" action_name="CLOSE_SCREEN" />

Available Actions


Business Logic

Progress Bar


Screen Navigation

Stacking of screens