Skip to main content

Set Serial Direct Insert (script step)

By July 1, 2023July 17th, 2023Online Help, Troi Serial Plug-in
Troi Serial Plug-in > Script steps reference > Set Serial Direct Insert
Troi Serial Plug-in for FileMaker Pro

Set Serial Direct Insert

Specifies how to insert data directly into the database when data is received. If you give an empty filename parameter, the direct insert is canceled.

SyntaxScript step badge

Set Serial Direct Insert [ Select ; Result (error) ; Port name ; File name ;
                           Table name; Field name ; Match string ;
                           Get last match ]

Options

Select entire contents replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error) an error code
Port name the name of the serial port to be coupled to this direct insert setting
File name the name of the file where the data needs to be inserted into
Table name the name of the table occurrence where the data needs to be inserted into
Field name the name of the field where the data needs to be inserted into
Match string (optional) wait for a match string before inserting the data
Get last match if checked the last string of text that matches the match string will be inserted

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0 no error DirectInsert was set
$$-50 paramErr there was an error with the parameters

Other errors may be returned.

Originated in

Troi Serial Plug-in 5.5

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

If the filename parameter is empty, the plug-in will no longer insert data directly into the database.

Example

Set Serial Direct Insert [ Select ; $ErrorCode ; "port1" ; 
	Get ( FileName ) ; "IncomingData"  ; "dataField" ; "OK" ]

This will set the Direct Insert for port1. Incoming data will be inserted into field “dataField” of table “IncomingData” of the current file. The data will not be inserted before the string “OK” is found.

Set Serial Direct Insert [ Select ; $ErrorCode ;  "COM2" ; Get ( FileName ) ;
		"IncomingData"  ; "dataField"  ; "¶" ]

This will set the DirectInsert for the COM2 port. Data will be directly inserted into field “dataField” of table “IncomingData” of the current file when a return is found in the incoming data.

Example 2

Set Serial Direct Insert [ Select ; $ErrorCode ;  "COM2" ; "" ) ]

This will reset the DirectInsert. Although the incoming data is still buffered, no action is taken when data is received. You can still get the data out by calling the Serial_Receive( ) function.

Related script stepScript step badge

Set Serial Trigger Script

Related functionsFunction badge

Serial_Open
Serial_SetDirectInsert

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 16 to 2023 –> Set Serial Direct Insert (serip7816) 2023-0717 13:14:32