After a database search is performed using a -Search, -FindAll, or -Random tag, [KeyColumn_Value] returns the value of the current key field. For FileMaker Pro databases, the [KeyColumn_Value] is the internal record ID value from the database. For MySQL databases, the [KeyField_Value] is equivalent to the method Field( KeyColumn_Name ).
After an -Add database action, [KeyColumn_Value] returns an identifier for the record that was just added. For FileMaker Pro databases, this is the internal record ID value. For MySQL databases, this is the value of the auto increment field in the tables, usually the ID primary key field.
After an -Update or -Duplicate database action the [KeyColumn_Value] is only defined for FileMaker Pro databases. It will return the internal record ID value for the record that was just updated or duplicated.
After a -SQL database action in a MySQL data source the [KeyColumn_Value] depends on which action was performed. After an INSERT statement for example, the [KeyColumn_Value] can be used to fetch the value for the auto increment field in the record that was just added.
Use the [KeyColumn_Value] method. The following example adds a new record to the People table of the Contacts database and returns the value for the primary key value of the new record.
Inline( -Add, -Database='Contacts', -Table='People', 'First_Name'='Elizabeth', 'Last_Name'='NewPerson') 'The added record has primary key value '+KeyColumn_Value /Inline
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.