ASCAN()

From Recital Documentation Wiki
Revision as of 10:54, 24 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Class

Array Processing


Purpose

Function to search an array for an expression


Syntax

ASCAN(<array>, <exp>, [<expN>])


See Also

AADD(), AAVERAGE(), ABROWSE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DECLARE, DIMENSION, GATHER, LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER, SET EXACT


Description

The ASCAN() function searches an array for the expression specified in <exp>. The expression may consist of any data type. It returns the element number at which the expression is located, or 0 if not found. The element number returned is the first occurrence of the string found. The SET EXACT command does not alter the find condition because the ASCAN() function works as if SET EXACT were OFF. The optional expression <expN> specifies the position at which to start the scan. If the <expN> is not specified then the search starts at the first element.


Example

use accounts
declare names[reccount(),1]
copy to array names fields company
element_no=ascan(names, "OK Cleaning Company")
if element_no > 0
    ? names[m->element_no]
    OK Cleaning Company
else
    dialog box "The company was not found."
endif


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer