Difference between revisions of "CONTAINS()"

From Recital Documentation Wiki
Jump to: navigation, search
Line 2: Line 2:
  
 
==Purpose==
 
==Purpose==
Function to determine whether the current record contains a specified character string
+
Function to perform a case-insensitive search of a record's character and (optionally) memo fields for a specified character string
  
  
 
==Syntax==
 
==Syntax==
CONTAINS(<expC>,<expL>|<expN>)
+
CONTAINS(<expC>,[<expL>|<expN>])
  
  
Line 14: Line 14:
  
 
==Description==
 
==Description==
The CONTAINS() function returns true (.T.) if the current record contains the specified character string, <expC>.
+
The CONTAINS() function returns .T. (True) if the current record contains the specified character string, <expC>.
  
CONTAINS() performs a case-insensitive search of the record's character and memo fields.
+
A case-insensitive search is performed on the current record's character fields.  If the optional <expL> is .T. (True) or the optional <expN> is 1, memo fields are also searched.
  
  
Line 35: Line 35:
 
open database southwind
 
open database southwind
 
use customers
 
use customers
// Restrict index to records containing string "USA"
+
// Restrict index to records with a character field containing string "USA", memos excluded
 
index on lower(companyname) for contains("USA",.F.)
 
index on lower(companyname) for contains("USA",.F.)
 
</code>
 
</code>

Revision as of 12:02, 17 November 2010

Template:YLM to do

Purpose

Function to perform a case-insensitive search of a record's character and (optionally) memo fields for a specified character string


Syntax

CONTAINS(<expC>,[<expL>|<expN>])


See Also

CHROVERLAP(), EMPTY(), EVALUATE(), EXPRCHECK(), FOR(), INDEX, INLIST(), INRANGE(), ISALPHA(), ISBLANK(), ISDIGIT(), MAX(), MAXVALUES(), MIN(), MINVALUES(), TYPE(), VARTYPE()


Description

The CONTAINS() function returns .T. (True) if the current record contains the specified character string, <expC>.

A case-insensitive search is performed on the current record's character fields. If the optional <expL> is .T. (True) or the optional <expN> is 1, memo fields are also searched.


Parameters Description
<expC> The character string to search for.
<expL> .
<expN> .


Example

open database southwind
use customers
// Restrict index to records with a character field containing string "USA", memos excluded
index on lower(companyname) for contains("USA",.F.)


Products

Recital Server, Recital