LassoScript Utility
Basics Browse Detail

-Operator

Tag Link -Operator Category Operator
Type Command Source Available No
Support Preferred Version 2.5
Change Unchanged Data Source Any, Lasso MySQL
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x, Lasso 2.5

Description

-Operator sets the field matching operator which is used for the next name/value pair. The -Operator tag 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

Syntax

[Inline: -Operator='Operator', 'Field_Name'='Value', ...]

<a href= "default.lasso?-Operator=Operator&Field_Name=Value&...">Link</a>

<form action="default.lasso" method="POST">
<input type="hidden" name="-Operator" value="Operator">
<input type="text" name="Field_Name" value="Value">
...
</form>

Parameters

Required Parameters
Operator The field matching operator. One of BW, EW, CN, LT, LTE, GT, GTE, EQ, NEQ, FT, RX, NRX.

Examples

To specify what field-level operator to use in a database action:

Use the -Operator command tag. The following example specifies a -Search action in [Inline] ... [/Inline] tags. The field First_Name is searched using a contains operator CN. This returns records for both Beth Surname and Mary Beth LastName since both names contain Beth.

[Inline: -Search,
    -Database='Contacts',
    -Table='People',
    -Operator='CN',
    'First_Name'='Beth']
  [Records]
    <br>[Field: 'First_Name'] [Field: 'Last_Name']
  [/Records]
[/Inline]

<br>John Doe
<br>John Surname

To perform a full-text search on a field in MySQL:

If a MySQL field is indexed as full-text, then using -Operator='ft' before the field in a search inline performs a MySQL full text search on that field. The example below performs a full text search on the Jobs field in the Contacts database, and returns the First_Name field for each record that contain the word Manager. Records that contain the most instances of the word Manager are returned first.

[Inline: -Search, -Database='Contacts', -Table='People',
-Operator='ft', 'Jobs'='Manager']
[Records]
[Field:'First_Name']

[/Records]
[/Inline]

Mike

Jane

\0

To use regular expressions as part of a MySQL search:

Regular expressions can be used as part of a search value for a field by using -Operator='rx' before the field in a search inline. The following example searches for all records where the Last_Name field contains eight characters using a regular expression. Using -Operator='nrx' searches for fields that do not contain eight characters.

[Inline: -Search, -Database='Contacts', -Table='People',
-Operator='rx', 'Last_Name'='.{8}',-MaxRecords='All']
[Records]
[Field:'Last_Name'], [Field:'First_Name']

[/Records]
[/Inline]

\0

Lastname, Mike

Lastname, Mary Beth

\0