ifind()

Read(2788) Label: index, in-memory table, key value,

Description:

Search for a specified key value in an in-memory table according to the index.

Syntax:

T.ifind(k,...;I)

Note:

The function searches for key value k in in-memory table T according to index I and return a sequence of matching records, or null if no matching records are found.

Parameter:

T

An in-memory table

I

Index name

k

Key value

Option:

@p

Return a sequence of ordinal numbers of matching records

@1

Return the first matching record

Return value:

Sequence/null

Example:

 

A

 

1

=demo.cursor("select EID,NAME,GENDER,SALARY from employee").memory()

Return an in-memory table.

2

=A1.index(test_ifind,SALARY>=11000;GENDER)

Create test_ifind index on GENDER field.

3

=A1.ifind("M";test_ifind)

Use test_ifind index to search for and return records of the in-memory table whose key value is M according to test_ifind index.

4

=A1.ifind@p("M";test_ifind)

Return a sequence of ordinal numbers of records.

5

=A1.ifind@1("M";test_ifind)

Return the first-found record.