Programming Guide



NEW

Prepares screen for data entry

int sm_tm_command ("NEW [ tableViewName [ tableViewScope ] ]");

Arguments

tableViewName
The name of a table view in the current transaction. A table view can only be specified if the mode has already been set to new. This parameter is case sensitive.

If tableViewName is specified, the command is applied according to the tableViewScope parameter. Since the entire table view tree might not be included, this is known as a partial command, and sm_tm_command sets TM_FULL to 0.

If tableViewName is not specified, the command is applied for each table/server view, starting with the root table view. This is known as a full command, and sm_tm_command sets TM_FULL to 1.

tableViewScope
One of the following parameters, which must be preceded by a table view name.

Description

NEW clears each field and prepares it for data entry. To insert data successfully, all the fields in a table view that are participating in the SQL INSERT statement need to have the same number of occurrences.

After you select NEW, the following steps occur:

  1. If you have made changes in the table views on which this command operates in a previous NEW, COPY or SELECT, you are prompted to discard your changes. If you choose OK, changes are discarded and fields in the specified table views are cleared. If you choose Cancel, you return to the screen so you can save your changes. You must then select NEW again.
  2. The fields are cleared of all previous values.
  3. The transaction mode is set to new. By default, this mode clears all the protection bits in updatable table views to reflect that data entry is available in those widgets.
  4. Before image processing for the screen is enabled. Any changes made to the screen following this step can then be processed using SAVE.

Push buttons and menu selections for the NEW command can choose to set the class property to new_button. By default, new_button is active in initial and view modes.

Sequence

To save the additions, select SAVE as the next transaction command. To discard the additions, select CLOSE or FORCE_CLOSE.

If you are entering a series of rows, COPY copies the data on a screen so it can then be edited, without having to enter the data again.

Events

The following requests can be generated by the NEW command to ascertain whether the changes from the previous command have been saved and, if desired, discard those changes: