Old Value Argument

Use the Old Value Argument field to map a mobile business object(MBO) parameter to a second (old) argument in update or delete operations.

Use the Old value argument field to change an update or delete operation's parameter from its current value to a new value, while still allowing access to the parameter through the previously defined argument. For example, if you use the update/delete operation of an MBO to modify/delete the lname parameter's argument from Jones to Smith, the Argument value is Smith, and if you choose to, you can map the Old value argument to Jones.

The old value is available from a drop down list, in the form old.argument_name (where argument_name is the name of the original argument, lname in the above example. The Un-map option unmaps the old value.

The old value argument does not support bigstring or bigbinary datatypes.

The Old value argument field is available from a number of Properties view locations, including:
Note: Although the parameter can be mapped to both Argument and Old value argument, when you select Show Figure, only the connection to the Argument displays.

Avoiding synchronization conflicts with the old value argument

If a mobile business object (MBO) performs an update or delete operation, the device sends additional parameters to the server that contain the original values of the database columns mapped to the object's parameters. These original values are shared with the enterprise information system (EIS) server in specially-named arguments. That is, if an argument is named A, and if the original value is available, it is provided in the argument named old.A. By checking whether or not the original value has become stale, the EIS operation can avoid conflicting updates, also known as Optimistic Concurrency Control (OCC).

Old value argument with an Update operation

Consider a database that contains table Person with three columns: socialsecurity_num (pk), fname, and lname. Then consider what happens in case of updates by different device applications.
  1. Two devices, D1 and D2, have downloaded a row 999-55-1212, 'Joe', 'User'.
  2. D1 updates the fname to Jane and succeeds.
  3. D2 updates lname to Yooser, and consequently supplies the original values Joe and User.

Because the current lname (Jane) is not same as old.fname (Joe) the update for D2 does not occur.

Old value argument with a Delete operation

This example illustrates the steps for support of the delete operation old value argument:
  1. Create an MBO from a JDBC data source using this SQL statement:
    SELECT * FROM contact
  2. Create a Delete operation defined as:
    DELETE FROM sampledb.dba.contact
    WHERE (id = :id)
     AND (:first_name IS NOT NULL)
     AND (first_name = :old.first_name)
    
  3. Deploy the MBO and create a client application that loads all data from the enterprise information system (EIS) to the client.
  4. For a given row, for example, id=1, client one modifies first_name (Jane) to Mary.
  5. Client two fails when attempting to delete the changed row whose id=1, since the first_name has changed.
Related concepts
Entity Read Operations
Output Mapping
Related tasks
Creating Attributes for a Mobile Business Object
Creating Operations for a Mobile Business Object
Creating the Mobile Business Object using the Mobile Business Object Palette item
Previewing Mobile Business Objects
Modifying Load Arguments