Lasso Soft Inc. > Home

[ inline ]

Method

The [Inline] method is used to perform a Lasso action. [Inline] methods allow multiple database actions to be performed within a single file or for authentication information to be specified for a code block. Authentication may be necessary for reading or writing files to the file system including file uploads, using [os_process] or [sys_process], or working with PDFs or images.

The [Inline] method accepts multiple keywords and name/value pairs as parameters. The action defined by the keywords (if any) is performed, and the results of the action are available within the [Inline] capture block. Note that the use of multiple keywords that perform conflicting database actions, e.g. -add and -search, will be resolved by using the last database action listed in the inline. Similarly if duplicate name/value pairs are listed in the inline, only the last name/value will be used.

The [Inline] method will accept array parameters. Each array parameter should contain only pairs. The pairs are inserted into the array as if they were specified starting at the location of the array parameter. The [Action_Params] array is often passed as a parameter to an [Inline].

The [Inline] method accepts an optional keyword/value parameter -InlineName which is used to name the result set of the inline. The results can be fetched by passing the same -InlineName to the [Records] method after the closing of the inline capture block.

The -Username and -Password command parameters can be used to set the user which should should be used to authenticate both the action specified in the [Inline] method and all of the methods enclosed within the capture block.

The [Inline] method functions almost as a delimiter around a separate format file. The error is reset upon entering an inline. Action parameters from the surrounding format file are not available unless specifically passed into the inline as name/value pairs.

If the -StatementOnly parameter is specified, then Lasso will create the SQL statement or data source specified action statement required to perform the specified database operation, but the operation will not be performed. The [Action_Statement] method can be used to retrieve the generated statement within the inline capture block.

In Lasso 9 the [Inline] ... [/inline] syntax can be replaced with a capture block: [inline() => { ... }]. Capture blocks do not return any output unless the caret (^) is used. Without a caret, capture blocks reduce white space and potentially decrease delivery time due to less bytes being transmitted to the end user.

Table of Keyword Parameters

Keyword Description
-Add

The -Add keyword allows a record to be added to a database table.

The database and table for the add action should be specified using the -Database and -Table keywords. Additional name/value parameters specify the starting values for the record to be added to the database.

-ContentType

-ContentType can be used in a hidden input within an HTML form to control what character set is used by Lasso to import the following input, textarea, select, etc. The value of the hidden input must be of the form "charset=iso-8859-1" (using any valid character set). The value is not valid if it simply specifies a character set without the "charset=" prefix. By default Lasso will use the character set that is set within Site Administration to interpret incoming POST parameters. Note: This keyword will affect the [Action_Param] and [Action_Params] methods, but will not affect the [Client_GetParams] or [Client_PostParams] methods (or their args counterparts).

-Database

The -Database keyword specifies the name of the database which should be used for a database action.

The value specified for this keyword can be retrieved using the [Database_Name] method.

-Delete

The -Delete keyword allows a record to be removed from a database table.

The database and table for the delete action should be specified using the -Database and -Table keywords. The specific record to be deleted should be specified using the -KeyField and -KeyValue keywords to identify the primary key field and specific key value.

-Distinct

Using the -Distinct keyword in an [Inline] causes a -Search or -Findall action to only output MySQL records that contain unique field values for a returned field. This is equivalent to performing a SELECT DISTINCT statement in SQL. Will output the first record containing a unique value only.

-Duplicate

The -Duplicate keyword allows a record to be duplicated within a FileMaker Pro database.

The database and table for the duplicate action should be specified using the -Database and -Table keywords. The specific record to be duplicated should be specified using the -KeyField and -KeyValue keywords to identify the primary key field and specific key value.

-Exec

source action which executes a prepared SQL statement. In order to use this action a -Prepare action must have been created in a surrounding inline. The value for -Exec should be an array with the same number of values as there are placeholders in the prepared SQL statement. For example, an INSERT can be written as a prepared statement as follows. The values to be inserted are left as placeholders. When this statement is executed by the following action, the placeholders are filled with their respective values. Prepared statements are most useful when they are prepared once and then executed many times. By preparing the statement the data source can optimize its access and perform many INSERT or UPDATE operations more quickly than they could be performed otherwise.

inline(-database='Contacts', -prepare='INSERT INTO People (First,Last) VALUES (?, ?)')
inline(-exec=array('John', 'Doe'))
/inline
inline(-exec=array('Jane', 'Person'))
/inline
inline(-exec=array('Ray', 'Surname'))
/inline
/inline

-FindAll

The -FindAll keyword allows all records within a database table to be returned.

The database and table for the find all action should be specified using the -Database and -Table keywords.

-FMScript

-FMScript specifies a script to be processed after the current database action has been performed. Requires a single parameter which names a FileMaker Pro script. Synonym is -FMScriptPost.

This keyword must be used in concert with a database action that results in records being found. The -FindAll action can be used if no specific records are required when the script is run.

-FMScriptPost

-FMScriptPost specifies a script to be processed after the current database action has been performed. Requires a single parameter which names a FileMaker Pro script. Synonym is -FMScript.

This keyword must be used in concert with a database action that results in records being found. The -FindAll action can be used if no specific records are required when the script is run.

-FMScriptPre

-FMScriptPre specifies a script to be processed before the current database action has been performed. Requires a single parameter which names a FileMaker Pro script.

This keyword must be used in concert with a database action that results in records being found. The -FindAll action can be used if no specific records are required when the script is run.

-FMScriptPreSort

-FMScriptPreSort specifies a script to be processed after the current database action has been performed, but before the results have been sorted. Requires a single parameter which names a FileMaker Pro script.

This keyword must be used in concert with a database action that results in records being found. The -FindAll action can be used if no specific records are required when the script is run.

-FormContentType

-FormContentType can be used in a hidden input within an HTML form to control what character set is used by Lasso to import each of the following inputs, textareas, selects, etc. The value of the hidden input must be of the form "charset=iso-8859-1" (using any valid character set). The value is not valid if it simply specified a character set without the "charset=" prefix. By default Lasso will use the character set that is set within Site Administration to interpret incoming POST parameters. Note: This keyword will affect the [Action_Param] and [Action_Params] methods, but will not affect the [Client_GetParams] or [Client_PostParams] methods (or their args counterparts).

-GroupBy

-GroupBy can be used within inlines for MySQL and other data sources to add a GROUP BY element to the generated SQL statement. The value of the parameter should be the name of a field in the current table. The results of the SQL statement will then be grouped so each distinct value in this field is returned only once.

-Host

-Host allows a data source host to be specified entirely within an inline method. Using this parameter allows a data source to be accessed without first setting up the data source in Lasso Security. When this parameter is used, Lasso security is not consulted about the data source request, so the security of the data must be controlled within the data source itself. The -Host parameter requires an array value which include keyword/value pairs specifying the characteristics of the data source host. This format is very similar to how parameters are specified for the inline itself. The example syntax shows an inline using a MySQL data source host on the local machine using the default 'root' user with no password. The -Host parameter in a nested inline can also take a value of 'Inherit' to inherit the data source host from the surrounding inline. See below for more details.

The possible values for the -Host array include the following.

  • -Datasource is required and specifies the type of data source host that is being created. Either the friendly or internal name of data source connectors can be used.
  • -Name is required for most data sources and specifies the IP address, host name, or connection string for the data source host.
  • -Port is optional and specifies an alternate port for connecting to a remote data source. This value defaults to an appropriate value for most data sources. The -Port may be used for other purposes in some data sources.
  • -Username and -Password are optional and specify the authentication information for the data source.
  • -TableEncoding specifies an optional table encoding for the data source. All data sources will default to using UTF-8 as their character set unless the encoding is specified explicitly using this parameter.
  • -Schema and -Extra are required by some data sources.

See the documentation in the Lasso Setup Guide for more details.

Nested inlines will inherit the host and database from the outer inline provided they do not specify a different -Database. If they do specify a different -Database they must use -Host='Inherit' in order to inherit the settings of the outer inline. Otherwise, the specified database will be looked up in Lasso Security.

[Inline(-Host=Array(-Datasource='MySQLDS', -Name='127.0.0.1', -Username='Root', -Password=''), -Database='MyDatabase', -Table='MyTable', -FindAll, -MaxRecords='all')] code [/Inline]

-Key

-Key allows a query to be specified which will determine what records are affected by an -Update or -Delete action. The -Key parameter offers an alternative to using -KeyField and -KeyValue to selected a single record to be updated or deleted. The -Key parameter requires an array value which include keyword/value pairs specifying the query that will be used to search for the records to be updated or deleted. This format is very similar to how a search query is specified within an inline. The query can use -Op or -OpBegin and -OpEnd parameters to specify complex search queries. The example syntax shows an inline that updates all records with a last name of Doe to have a last name of Person and an inline that deletes all records with a first name of John or a last name of Doe from the database.

[Inline(-Update, -Database='Contacts', -Table='People', -Key=Array(-Op='Eq', 'Last_Name'='Doe'), 'Last_Name'='Person')]...[/Inline] [Inline(-Delete, -Database='Contacts', -Table='People', -Key=Array(-OpBegin='Or', -Op='Eq', 'First_Name'='John', 'Last_Name'='Doe', -OpEnd='Or'))]...[/Inline]

-KeyColumn

-KeyColumn specifies the name of the key field which should be used for a database action. This keyword can be used in concert with the -KeyValue keyword to identify a particular record for a -Delete, -Duplicate, -Image, or -Update action. Synonym is -KeyField.

The value specified for this keyword can be retrieved using the [KeyField_Name] method.

FileMaker Note: The -KeyField for FileMaker Pro databases is ignored. The -KeyValue always specifies the value for the implicit Record ID.

-KeyField

-KeyField specifies the name of the key field which should be used for a database action. This keyword can be used in concert with the -KeyValue keyword to identify a particular record for a -Delete, -Duplicate, -Image, or -Update action. Synonym is -KeyColumn.

The value specified for this keyword can be retrieved using the [KeyField_Name] method.

FileMaker Note: The -KeyField for FileMaker Pro databases is ignored. The -KeyValue always specifies the value for the implicit Record ID.

-KeyValue

-KeyValue specifies the value of the key field which should be used for a database action. This keyword must be used in concert with the -KeyField keyword to identify a particular record for a -Delete, -Duplicate, -Image, or -Update action.

The value specified for this keyword can be retrieved using the [KeyField_Value] method.

FileMaker Note: The -KeyField for FileMaker Pro databases is ignored. The -KeyValue always specifies the value for the implicit Record ID.

-Layout

-Layout specifies the name of the table/layout which should be used for a database action. Synonym is -Table.

The value specified for this keyword can be retrieved using the [Layout_Name] or [Table_Name] methods.

-LayoutResponse

-LayoutResponse instructs FileMaker Server Advanced data sources which layout should be used to format the results of the database request. This allows one layout to be used to perform the database request and a second layout to be used to return the results of that request. By cutting down on the fields which are referenced on the response layout the speed of FileMaker requests can be improved.

-Log

-Log specifies at what level the action statement from an inline should be logged. The value can be Critical, Detail, Warning, SQL, Deprecated, or None. The action statement is an internal representation of the action that the inline is going to perform and can differ from data source to data source. Most SQL-based data sources will generate a SQL action statement. Other data sources may generate URLs or other information as the action statement. The action statement can also be accessed by calling [Action_Statement] within an inline. By default action statements are logged at the SQL level.

-MaxRecords

-MaxRecords specifies the maximum number of records which should be displayed on each page from a -Search or -FindAll action. The default is 50 if no -MaxRecords keyword is specified. Synonym is -MaxRows. The special value -MaxRecords='all' can be used to specify that all records from the current database action be returned. On -Add and -Update actions in Lasso MySQL specifying -MaxRecords=0 will instruct Lasso not to return any results from the database action. This keyword can be used in concert with the -SkipRecords keyword to page through a found set. The value specified for this keyword can be retrieved using the [MaxRecords_Value] method. Note: The -MaxRecords keyword applies to the results of SQL statements specified in the -SQL keyword in an [Inline]. To return all the results from a SQL statements always specify -MaxRecords='all' in the opening [Inline] method.

-MaxRows

-MaxRows specifies the maximum number of records which should be displayed on each page from a -Search or -FindAll action. The default is 50 if no -MaxRows keyword is specified. Synonym is -MaxRecords.

This keyword can be used in concert with the -SkipRows keyword to page through a found set.

The value specified for this keyword can be retrieved using the [MaxRows_Value] method.

-Not

-Not is used to start a new query within a FileMaker Server 9 inline. The result of the inline will not include records which match the following query. All of the parameters within each query are combined using an "and" logical operator. Each field name may only be specified once per query. The -Or keyword can be used to start a new query which extens the results of the Inline.

-Nothing

The -Nothing keyword specifies that no database action should be performed in the current [Inline], HTML form, or URL.

Since the default is to perform no database action, use of the -Nothing keyword is equivalent to not specifying an action.

-NoValueLists

-NoValueLists works with FileMaker Server Advanced datasources. If specified in an [Inline] this keyword suppresses the automatic fetching of value lists from the current layout. This can greatly speed up database actions if the value lists are not needed.

-Op

-Op sets the field matching operator which is used for the next name/value pair. The -Op keyword can have any of the values BW, EW, CN, LT, LTE, GT, GTE, EQ, NEQ for any data source. The default is BW for each name/value pair if no -Op is specified.

  • BW - Begins With.
  • EW - Ends With.
  • CN - Contains.
  • LT - Less Than.
  • LTE - Less Than or Equals.
  • GT - Greater Than.
  • GTE - Greater Than or Equals.
  • EQ - Equals.
  • NEQ - Not Equals.

The following operators may be used with MySQL data sources in Lasso Professional 6 and higher:

  • FT - Full Text Search
  • RX - Regular Expression Search
  • NRX - (Not) Regular Expression Search
-OpBegin

-OpBegin sets the logical operator which is used to combine all name/value pairs specified until the matching -OpEnd keyword is reached. The -OpBegin keyword can be set to AND, OR, or NOT.

AND means that each record which is returned matches the criteria of all name/value pairs included until the matching -OpEnd keyword.

OR means that each record which is returned matches the criteria of at least one of the name/value pairs until the matching -OpEnd keyword.

NOT means that each record which is returned does not match the criteria of the name/value pairs until the matching -OpEnd keyword. Note: This keyword is not supported with FileMaker Pro data sources due to limitations of the FileMaker Web Companion.

-OpEnd

-OpEnd is required for each -OpBegin keyword which is included in an action. The logical operator specified in the -OpBegin keyword is in effect until the matching -OpEnd keyword is reached.

The operator specified in the -OpEnd keyword is optional, but should be specified as the same operator in the matching -OpBegin keyword for best results. Note: This keyword is not supported with FileMaker Pro data sources due to limitations of the FileMaker Web Companion.

-Operator

-Operator sets the field matching operator which is used for the next name/value pair. The -Operator keyword can have any of the values BW, EW, CN, LT, LTE, GT, GTE, EQ, NEQ when used with any data source. The default is BW for each name/value pair if no -Operator is specified.

  • BW - Begins With.
  • EW - Ends With.
  • CN - Contains.
  • LT - Less Than.
  • LTE - Less Than or Equals.
  • GT - Greater Than.
  • GTE - Greater Than or Equals.
  • EQ - Equals.
  • NEQ - Not Equals.

The following operators may be used with MySQL data sources only in Lasso 6 and higher:

  • FT - Full Text Search
  • RX - Regular Expression Search
  • NRX - (Not) Regular Expression Search
-OperatorBegin

-OperatorBegin sets the field-level logical operator which is used to combine all name/value pairs specified until the matching -OperatorEnd keyword is reached. The -OperatorBegin keyword can be set to AND, OR, or NOT.

AND means that each record which is returned matches the criteria of all name/value pairs included until the matching -OperatorEnd keyword.

OR means that each record which is returned matches the criteria of at least one of the name/value pairs until the matching -OperatorEnd keyword.

NOT means that each record which is returned does not match the criteria of the name/value pairs until the matching -OperatorEnd keyword.

-OperatorEnd

-OperatorEnd required for each -OperatorBegin keyword which is included in an action. The field-level logical operator specified in the -OperatorBegin keyword is in effect until the matching -OperatorEnd keyword is reached.

The operator specified in the -OperatorEnd keyword is optional, but should be specified as the same operator in the matching -OperatorBegin keyword for best results.

-OperatorLogical

-OperatorLogical sets the logical operator which is used to combine all name/value pairs specified within a search database action. The -OperatorLogical keyword can be set to either AND or OR. The default if no -OperatorLogical keyword is specified is AND.

AND means that each record which is returned matches the criteria of all name/value pairs included in the search action.

OR means that each record which is returned matches the criteria of at least one of the name/value pairs included in the search action.

-OpLogical

-OpLogical sets the logical operator which is used to combine all name/value pairs specified within a search database action. The -OpLogical keyword can be set to either AND or OR. The default if no -OpLogical keyword is specified is AND.

AND means that each record which is returned matches the criteria of all name/value pairs included in the search action.

OR means that each record which is returned matches the criteria of at least one of the name/value pairs included in the search action.

-Or

-Or is used to start a new query within a FileMaker Server 9 inline. The result of the inline will include records which match either the first query or the second query. All of the parameters within each query are combined using an "and" logical operator. Each field name may only be specified once per query. The -Not keyword can be used to start a new query which omits records from the results of the Inline.

-Password

-Password sets the password for the user in Lasso security whose permissions should be used to execute the code within [Inline] ... [/Inline] methods. A -Username keyword must also be specified with the username of the user in Lasso Security.

The specified username and password apply both to the action which is specified within the opening [Inline] method and to all methods executed within the [Inline] ... [/Inline] method.

This keyword may also be used in HTML forms and URLs, but is not generally recommended since the user name and password will be visible to the current site visitor.

-Prepare

-Prepare is a data source action which allows a SQL statement to be prepared for later execution. Prepared statements are executed using the -Exec statement within multiple nested inlines. This action does not perform a database operation itself, but sets up the data source in order to perform the same operation multiple times using -Exec very quickly. The value for -Prepare should be a SQL statement like that which would be passed to the -SQL action, but one or more values can be replaced by question marks in order to mark them as a placeholder which will be filled with values when the statement is later executed. For example, an INSERT can be written as a prepared statement as follows. The values to be inserted are left as placeholders. When this statement is executed by the following action, the placeholders are filled with their respective values. Prepared statements are most useful when they are prepared once and then executed many times. By preparing the statement, the data source can optimize its access and perform many INSERT or UPDATE operations more quickly than they could be performed otherwise.

inline(-database='Contacts', -prepare='INSERT INTO People (First,Last) VALUES (?, ?)')
  inline(-exec=array('John', 'Doe'))
  /inline
  inline(-exec=array('Jane', 'Person'))
  /inline
  inline(-exec=array('Ray', 'Surname'))
  /inline
/inline

-Random

The -Random keyword returns a random record from a FileMaker Pro database.

The database and table for the random action should be specified using the -Database and -Table keywords.

-Req

-Req specifies that the name/value parameter that follows must have a value specified. This keyword is usually used in HTML forms to ensure that values have been entered for all required form inputs. Synonym is -Required.

-Required

-Required specifies that the name/value parameter that follows must have a value specified. This keyword is usually used in HTML forms to ensure that values have been entered for all required form inputs. Synonym is -Req.

-Response

-Response specifies the result for a Classic Lasso action which is performed in an HTML form or URL. The file specified by this keyword will be used if no more specific -Response... keyword is specified for the current action. Equivalent to -ResponseAny.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseAdd

-ResponseAdd specifies the result for a Classic Lasso -Add action which is performed in an HTML form or URL. If the current database action is not an -Add action then the page specified in a -Response or -ResponseAny keyword will be used instead. If an error occurs while performing an -Add action then the page specified in a -ResponseAddError or -ResponseAnyError keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseAddError

-ResponseAddError specifies the page to return if an error occurs during a Classic Lasso -Add action which is performed in an HTML form or URL. If a different error occurs while performing an -Add action then the page specified in a -ResponseAnyError, -ResponseAdd, or -ResponseAny keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseAny

-ResponseAny specifies the result for a Classic Lasso action which is performed in an HTML form or URL. The file specified by this keyword will be used if no more specific -Response... keyword is specified for the current action. Equivalent to -Response.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseAnyError

-ResponseAnyError specifies the page to return if an error occurs during a Classic Lasso action which is performed in an HTML form or URL. If neither this keyword nor a -Response...Error keyword for a particular action is defined then the standard -ResponseAny keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseDelete

-ResponseDelete specifies the result for a Classic Lasso -Delete action which is performed in an HTML form or URL. If the current database action is not a -Delete action then the page specified in a -Response or -ResponseAny keyword will be used instead. If an error occurs while performing a -Delete action then the page specified in a -ResponseAnyError keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseDuplicate

-ResponseDuplicate specifies the result for a Classic Lasso -Duplicate action which is performed in an HTML form or URL. If the current database action is not a -Duplicate action then the page specified in a -Response or -ResponseAny keyword will be used instead. If an error occurs while performing a -Duplicate action then the page specified in a -ResponseAnyError keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseLassoApp

The -ResponseLassoApp keyword allows a single format file from within a LassoApp to be returned. The path to the file should be specified as an absolute path from the root of the LassoApp.

Note: The -ResponseLassoApp keyword cannot be used as the response for a Classic Lasso action.

-ResponseNoResultsError

-ResponseNoResultsError specifies the page to return if an error occurs during a Classic Lasso -Search, -Random, or -FindAll action which is performed in an HTML form or URL. If a different error occurs while performing one of these actions then the page specified in a -ResponseAnyError, -ResponseAdd, or -ResponseAny keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseReqColumnMissingError

-ResponseReqColumnMissingError specifies the page to return if a required column is missing a value within a Classic Lasso action which is performed in an HTML form or URL. If this keyword is not specified then the standard -ResponseAnyError or -ResponseAny keyword will be used instead.

Equivalent to -ResponseReqFieldMissingError, -ResponseRequiredFieldMissingError, and -ResponseRequiredColumnMissingError.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseReqFieldMissingError

-ResponseReqFieldMissingError specifies the page to return if a required field is missing a value within a Classic Lasso action which is performed in an HTML form or URL. If this keyword is not specified then the standard -ResponseAnyError or -ResponseAny keyword will be used instead.

Equivalent to -ResponseRequiredFieldMissingError, -ResponseReqColumnMissingError, and -ResponseRequiredColumnMissingError.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseRequiredColumnMissingError

-ResponseRequiredColumnMissingError specifies the page to return if a required column is missing a value within a Classic Lasso action which is performed in an HTML form or URL. If this keyword is not specified then the standard -ResponseAnyError or -ResponseAny keyword will be used instead. Equivalent to -ResponseReqFieldMissingError, -ResponseReqColumnMissingError, and -ResponseRequiredFieldMissingError. The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined. Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] methods or the visitor should be redirected to another page using [Redirect_URL].

-ResponseRequiredFieldMissingError

-ResponseRequiredFieldMissingError specifies the page to return if a required field is missing a value within a Classic Lasso action which is performed in an HTML form or URL. If this keyword is not specified then the standard -ResponseAnyError or -ResponseAny keyword will be used instead.

Equivalent to -ResponseReqFieldMissingError, -ResponseReqColumnMissingError, and -ResponseRequiredColumnMissingError.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseSecurityError

-ResponseSecurityError specifies the page to return if a security or permissions error occurs during a Classic Lasso action which is performed in an HTML form or URL. If this keyword is not specified then the standard -ResponseAnyError or -ResponseAny keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseUpdate

-ResponseUpdate specifies the result for a Classic Lasso -Update action which is performed in an HTML form or URL. If the current database action is not an -Update action then the page specified in a -Response or -ResponseAny keyword will be used instead. If an error occurs while performing an -Update action then the page specified in a -ResponseUpdateError or -ResponseAnyError keyword will be used.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ResponseUpdateError

-ResponseUpdateError specifies the page to return if an error occurs during a Classic Lasso -Update action which is performed in an HTML form or URL. If a different error occurs while performing an -Update action then the page specified in a -ResponseAnyError, -ResponseUpdate, or -ResponseAny keyword will be used instead.

The file path parameter for this keyword should be absolute from the root of the Web serving folder or should be specified relative to the HTML form action or the base of the URL in which the action is defined.

Note: -Response... keywords cannot be used with an action specified in an [Inline] method. Instead, the results of the action should be formatted within the [Inline]...[/Inline] method or the visitor should be redirected to another page using [Redirect_URL].

-ReturnColumn

-ReturnColumn specifies the name of a field which should be returned with the results of a database action. Synonym is -ReturnField.

If one or more -ReturnColumn keywords are specified then only the named fields will be returned. If no -ReturnColumn keywords are specified then all fields in the specified table will be returned.

Only one field can be named in each -ReturnColumn keyword. To return multiple fields, use multiple -ReturnColumn keywords.

-ReturnField

-ReturnField specifies the name of a field which should be returned with the results of a database action. Synonym is -ReturnColumn.

If one or more -ReturnField keywords are specified then only the named fields will be returned. If no -ReturnField keywords are specified then all fields in the specified table will be returned.

Only one field can be named in each -ReturnField keyword. To return multiple fields, use multiple -ReturnField keywords.

-Schema

The -Schema keyword specifies the name of the user schema which should be used for a database action on a JDBC data source. Available only for JDBC data sources that support named schema ownership. The schema name passed here overrides the default schema set for the JDBC data source host in Lasso Administration.

The value specified for this keyword can be retrieved using the [Schema_Name] method.

-Search

The -Search keyword allows a query to be performed in a database table and the results returned.

The database and table for the search action should be specified using the -Database and -Table keywords. Additional name/value parameters specify the arguments which will be used to define the search within the database table.

-Show

The -Show keyword allows the schema of a database table to be displayed.

The database and table for the show action should be specified using the -Database and -Table keywords.

-SkipRecords

-SkipRecords specifies the offset into the records which should be returned from a -Search or -FindAll action. The default is 1 if no -SkipRecords keyword is specified so the first record will be returned. Synonym is -SkipRows.

This keyword can be used in concert with the -MaxRecords keyword to page through a found set.

The value specified for this keyword can be retrieved using the [SkipRecords_Value] method.

-SkipRows

-SkipRows specifies the offset into the records which should be returned from a -Search or -FindAll action. The default is 1 if no -SkipRows keyword is specified so the first record will be returned. Synonym is -SkipRecords.

This keyword can be used in concert with the -MaxRows keyword to page through a found set.

The value specified for this keyword can be retrieved using the [SkipRows_Value] method.

-SortColumn

-SortColumn specifies the name of a field which should be used to sort the results that are returned from a database action. Synonym is -SortField.

Can be used in concert with a -SortOrder keyword to sort the field in Ascending, Descending, or Custom (data source dependent) order. Multiple -SortColumn keywords can be used for compound sorts.

-SortField

-SortField specifies the name of a field which should be used to sort the results that are returned from a database action. Synonym is -SortColumn.

Can be used in concert with a -SortOrder keyword to sort the field in Ascending, Descending, or Custom (data source dependent) order. Multiple -SortField keywords can be used for compound sorts.

-SortOrder

When specified after a -SortField or -SortColumn keyword, -SortOrder specifies the order in which the field or column should be sorted. Possible values include Ascending or Descending to sort in alphabetical or numerical order and Custom to sort in a data source dependent order.

FileMaker Pro Note: Custom order can be used to sort a field in the order specified by a value list.

-SortRandom

-SortRandom sorts returned records randomly. Is used in place of the -SortField and -SortOrder parameters. Does not require a value.

-SQL

The -SQL keyword allows one or more SQL statements to be executed within a compatible data source. Multiple SQL statements are delimited by semi-colons. When performing multiple SQL statements, only the results of the last statement are output in the [Inline] ... [/Inline] method unless the [ResultSet] ... [/ResultSet] method is used.

Important: Any visitor supplied values which are concatenated into a SQL statement must be escaped in order to prevent SQL injection attacks. Values passed to other inline actions such as -Search, -Add, or -Update are automatically encoded by Lasso. Values passed to MySQL must be encoded using the [Encode_SQL] method. Values passed to other SQL-based data sources such as JDBC data sources or SQLite should use the [Encode_SQL92] method.

The data source within which the SQL statement should be executed is identified by naming a database using the -Database keyword. The SQL statement to be executed is specified as the parameter of the -SQL keyword. The -Database parameter is used solely to identify what data source to send the SQL command to.

Within the SQL statement you must always specify both the database and table names as in "SELECT * FROM Contacts.People".

The -MaxRecords and -SkipRecords keywords apply to the results returned from a SQL statement just as they do for results returned from other database actions. In order to return all the results from a -SQL action use -MaxRecords='all' in the opening [Inline] method.

Note: -SQL actions can only be performed within [Inline] methods. They cannot be performed through HTML forms or URLs even if Classic Lasso is enabled.

-StatementOnly

-StatementOnly instructs the data source connector to generate the action statement that it would send to the data source (i.e. the SQL statement), but not to actually send. The generated action statement can be fetched from within the [Inline] ... [/Inline] method using [Action_Statement].

-Table

-Table specifies the name of the table which should be used for a database action. Synonym is -Layout.

The value specified for this keyword can be retrieved using the [Table_Name] method.

-Token

-Token defines a named token. This keyword is unique among Lasso's keywords. It requires two parameters, the name of the token which is to be defined and the value for the token.

The name is specified after the -Token keyword followed by a period. -Token.First_Name defines a token named First_Name or -Token.34 defines a token named 34.

The value is specified in the same fashion as the value for any keyword. -Token.First_Name=John would set the token First_Name to the value John. -Token.34=Hello would set the token 34 to the value Hello.

The value for a named token can be retrieved using the [Token_Value] method. For example, [Token_Value('First_Name')] or [Token_Value('34')]. The value for a token can only be retrieved in the response page to an HTML form or URL based action which includes a -Token keyword or within the [Inline] ... [/Inline] method if the opening [Inline] includes a -Token keyword among its parameters.

In order to store and retrieve values within a single format file the [Variable] method should be used instead.

By simply specifying -Token=Value a single unnamed token can be created whose value can be retrieved with [Token_Value].

-Update

The -Update keyword allows a record to be updated within a database table.

The database and table for the update action should be specified using the -Database and -Table keywords. The specific record to be updated should be specified using the -KeyField and -KeyValue keywords to identify the primary key field and specific key value. Additional name/value parameters specify the new values for the record which is updated within the database table.

-UseLimit

-UseLimit prematurely ends a -Search or -FindAll action once the specified number of records for the -MaxRecords keyword have been found and returns the found records. Requires the -MaxRecords keyword. This issues an internal LIMIT statement to MySQL to cause it to search more efficiently.

-Username

-Username sets the user name for the user in Lasso security whose permissions should be used to execute the code within [Inline] ... /Inline] method. A -Password keyword must also be specified with the password for the user in Lasso Security.

The specified username and password apply both to the action which is specified within the opening [Inline] method and to all keywords executed within the [Inline] ... [/Inline] method.

This keyword may also be used in HTML forms and URLs, but is not generally recommended since the username and password will be visible to the current site visitor.

  • Syntax
inline(Keyword Parameters and Name/Value Pairs) => { code }

inline(-inlineName='Inline Name', Keyword Parameters and Name/Value Pairs) =>  { code }

inline(-Database='Database Name', -SQL='SQL Statement') => { code }

inline(Action_Params, Keyword Parameters and Name/Value Pairs) => { code }

inline(-Username='User Name', -Password='User Password')
	code
/inline
Examples
  • Beginner

Demonstrating the differences in output between syntax options

The following example demonstrates possible usage options for the inline method.

Note that #1 and #3 return the same output, whereas #2 returns nothing. The use of the auto-collect "^" within example #3's capture block enables the output even though it has been processed in exactly the same manner.

Code

'1: '
inline(-SQL='SELECT id FROM contacts WHERE email LIKE "@rhinos-rock.com"')
	'We found '+found_count+' contacts at rhinos-rock.com'
/inline

'<br />2:'
inline(-SQL='SELECT id FROM contacts WHERE email LIKE "@rhinos-rock.com"') => {
	'We found '+found_count+' contacts at rhinos-rock.com'
}

'<br />3: '
inline(-SQL='SELECT id FROM contacts WHERE email LIKE "@rhinos-rock.com"') => {^
	'We found '+found_count+' contacts at rhinos-rock.com'
^}

Result

1: We found 7 contacts at rhinos-rock.com
2:
3: We found 7 contacts at rhinos-rock.com

Nesting inlines

There are situations where a SQL JOIN is not possible, practical or desirable. Nesting inlines can achieve a similar result.

The example below simulates querying a contacts table on one database server, then fetching an invoice count from a different server.

Note: while this example is suboptimal for real world usage it demonstrates the technique.

Code

inline(
	-Database	= 'myDatabase',
	...
	-SQL='SELECT id,name FROM contacts WHERE email LIKE "@rhinos-rock.com"'
	) => {^
	'We found '+found_count+' contacts at rhinos-rock.com:<br />'
	records => {^
		local(invoiceCount = 0)
		inline(
			-Database	= 'remoteInvoiceDatasource',
			...
			-SQL='SELECT COUNT(*) AS inv FROM invoices WHERE id = '+integer(field('id'))+' LIMIT 1'
			) => {
			#invoiceCount = integer(field('inv'))
		}
		field('name')+' has purchased '+#invoiceCount+' times from our store.'
		'<br />'
	^}
^}

Result

We found 1 contact at rhinos-rock.com:
Bob Shortforcate has purchased 12 times from our store.

To specify a connection string to access a database

Use the [inline] method and specify the connection information using keyword parameters.

Code

inline(
	-Database	= 'myDatabase',
	-Username	= 'aWhiteRhino',
	-Password	= 'rhinosAreAwesome',
	-maxRecords	= 'all',
	-SQL='SELECT id,name FROM contacts WHERE email LIKE "@rhinos-rock.com"'
	) => {^
	'We found '+found_count+' contact'+(found_count > 1 ? 's')+' at rhinos-rock.com:<br />'
	records => {^
		field('name')+'<br />'
	^}
^}

Result

We found 1 contact at rhinos-rock.com:
Bob Shortforcate
Resources
  • Tips

MySQL: Nest inlines for connection efficiency.

Recent Comments

A nested inline copies the -maxrecords parameter value from a surrounding inline. In L8 this is different: each inline has its own -maxrecords and no previous value is copied:

inline(-database='test', -maxrecords='All');
'1) maxrecords_value=';maxrecords_value;'
';

inline(-table='members', -sql='select * from members');
'2) maxrecords_value=';maxrecords_value;'
';
'2) found_count=';found_count;'
';
/inline;
/inline;

inline(-database='test', -maxrecords='10');
'1) maxrecords_value=';maxrecords_value;'
';

inline(-table='members', -sql='select * from members');
'2) maxrecords_value=';maxrecords_value;'
';
'2) found_count=';found_count;'
';
/inline;
/inline;

Posted on: 21 February 2013

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.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft