Command PV FIND ONE

4D View

PV FIND ONE

version 6.8


PV FIND ONE (area; criteria; where; contains{; column; row })

ParameterTypeDescription
areaLongint4D View area
criteriaStringString to query
whereInteger0 = Formulas; 1 = Values
containsInteger0 = Contains; 1 = Equals
columnLongintStarting cell column number
Found cell column number
row LongintStarting cell row number
Found cell row number

Description

The PV FIND ONE command searches for criteria among the cells of the area. The search will stop at the first cell, if any, that meets the search criteria.

criteria specifies the character string to query.

where indicates which part of the spreadsheet to query:

• 0: Queries formulas

• 1: Queries values

contains defines the type of comparison:

• 0: Partial (contains the queried value)

• 1: Total (equal to the queried value)

If the column and row optional parameters are omitted, the search starts at the top left corner of the area.

If column and row are passed, they indicate the cell of the area from which the search will begin.

The search is carried out from top to bottom and left to right, beginning with the indicated cell.

After executing the command, the first cell eventually found becomes the new current cell. If they were called, the column and row parameters then contain coordinates.

If no cell was found during the search, the current cell remains unchanged.

Example

Let's query the first cell containing the user response to an initial request. The query will start in the cell B3.

   C_STRING(255;$Criteria)  `String to query
   C_INTEGER($QueryWhere)  `0=Formulas / 1=Values
   C_INTEGER($Contains)  `0=Equals / 1=Contains
   C_LONGINT($Column)  `Column number of found cell
   C_LONGINT($Row)  `Row number of found cell

   $Criteria:=Request("What value should be queried?";"x")

   If ($Criteria#"")  `Defined criteria
      CONFIRM("Query formulas or values?";"Values";"Formulas")
      $QueryWhere:=OK  `0=Formulas / 1=Values

      CONFIRM("What kind of comparison?";"Contains";"=")
      $Contains:=OK    `0=Contains / 1=Equals

       $Column:=2  `Search starting from cell B3
      $Row:=3 

      PV FIND ONE (Area;$Criteria;$QueryWhere;$Contains;$Column;$Row)  `Query
   End if  

See Also

PV FIND ALL, PV REPLACE ONE.