LassoScript Utility
Basics Browse Detail

[KeyColumn_Value]

Tag Link [KeyColumn_Value] Category Database
Type Substitution Source Available No
Support Synonym Version 3.0
Change Unchanged Data Source Any
Output Type String Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x

Description

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 tag [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.

Syntax

[KeyColumn_Value]

Parameters

Optional Parameters
Encoding Keyword Specifies the encoding for the tag's return value. Tags are encoded using -EncodeHTML by default if their value is output on a format file. No encoding is applied to nested tags unless an explicity encoding keyword is specified. One of -EncodeBreak, -EncodeHTML, -EncodeNone, -EncodeRaw, -EncodeSmart, -EncodeStrictURL, -EncodeURL, -EncodeXML.

Examples

To return the key field value for a record which was added to a database:

Use the [KeyColumn_Value] tag. 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']
  <br>The added record has primary key value [KeyColumn_Value]
[/Inline]

<br>The added record has primary key value 34.