TSWrite Function

The TSWrite function writes a value to a specific field on a specific record in a Sage 300 CRE Office database.

Syntax

TSWrite( table name , field name , value , action , [ key1 ] , [ ... keyn ] )

The TSWrite function syntax has these parts:

ArgumentDescription
table nameRequired. This argument identifies a specific internal table name in the Sage 300 CRE Office database.
field nameRequired. This argument identifies a specific internal field name. The field name must identify a valid field for the table identified by the table name argument.
valueRequired. This argument specifies the value to be written to the field identified by the field name argument.
actionRequired. This argument specifies the desired action.
key 1 ... key nRequired. These arguments provide the values of the primary key for the specific record desired. The number of key values and their meaning will depend on the table that was identified by the table name argument.

Action

The following values can be used for action:

ActionDescription
CreateOnlyIf the record indicated by key 1 ... key n is not found, it will be created.  Existing records will not be updated.
CreateOrModifyIf the record indicated by key 1 ... key n is found, it will be updated; otherwise it will be created.
ModifyOnlyIf the record indicated by key 1 ... key n is found, it will be updated; otherwise an error message is displayed on the Write Results Report.
IgnoreNo action will be taken.
NOTE - Leaving this parameter blank has the same result as specifying Ignore

Remarks

If multiple TSWrite functions write to the same record but specify different actions, a message will be displayed and you will be required to resolve all conflicting actions using the Approve Changes window before values can be sent to Sage 300 CRE.

If multiple TSWrite functions write to the same record and field, a message will be displayed and you will be required to remove the duplicates before values can be sent to Sage 300 CRE.

Example

Click here for examples.