Salesforce

MTblSet (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

MTblSet (Magic xpa 3.x)

Creates a record in a memory table where a BLOB variable is used as the table's content.

Syntax:

MTblSet(BLOB, table entry, DB table name, mode)

Parameters:

BLOB – A BLOB value that keeps the content of the memory table.

table entry – A literal or numeric value that corresponds to a memory table in the Data repository.

DB table name – This parameter lets you refer to a different instance of the table by its name.

mode – This parameter sets the mode for handling duplicate records. The mode values are:

0 Aborts duplicate records. A new record from the BLOB will be appended to the existing table. When encountering a duplicate record, the entire operation is aborted and no record is set.

1 Skips duplicate records. New records from the BLOB are appended to the existing table. When encountering a duplicate record, the record is skipped, and the next record in the BLOB is inserted.

2 Overwrites duplicate records. New records from the BLOB are appended to the existing table. When encountering a duplicate record, the new record replaces the existing duplicate record.

3 Reset existing table. The existing table is deleted and the records from the BLOB are recreated in a new table.

The mode value is set to 0 when a valid value (0,1,2,3) is not entered.

Returns:

0 when all the records are created successfully in the memory table.

The values returned when the function fails are:

-1 meaning that the Mode parameter is set to 0, but the memory table has duplicate indexes.

-2 meaning that the memory table structure does not match the table structure provided by the BLOB parameter.

-3 meaning that the table is not a memory table.

-4 meaning that the memory table has not been updated.

-5 meaning that the Mode parameter is set to 3, but the existing memory table cannot be deleted.

Usage:

Use this function together with the MTblGet function to keep the content of memory tables persistent so that the memory-table content can be stored and transferred as needed.

Note:

Every DB error found during the execution of the function is skipped until the end of the table content. The function updates the memory table as a nested transaction, regardless of the transaction setting of the current task. This means that all new records are committed in the table only when the function is completed. The memory table structure and the BLOB parameter structure must be the same and are checked by matching their column order, column number, and column attribute. Indexes and foreign keys are not checked. The DB Table Name parameter, which enables you to refer to another table by its name, is effective only if the same table entry is not opened by any active task at the time the function is executed.

See also:

The Online Samples project (program MT08)

Reference
Attachment 
Attachment