Aller au contenu principal
Version: Next

VP Find

VP Find ( rangeObj : Object ; searchValue : Text ) : Object
VP Find ( rangeObj : Object ; searchValue : Text ; searchCondition : Object } ) : Object
VP Find ( rangeObj : Object ; searchValue : Text ; searchCondition : Object ; replaceValue : Text ) : Object

ParamètresTypeDescription
rangeObjObject->Objet plage
searchValueText->Valeur de recherche
searchConditionObject->Objet contenant la/les condition(s) de recherche
replaceValueText->Valeur de remplacement
RésultatObject<-Objet plage

Description

The VP Find command searches the rangeObj for the searchValue. Des paramètres facultatifs peuvent être utilisés pour affiner la recherche et/ou remplacer les résultats trouvés.

In the rangeObj parameter, pass an object containing a range to search.

The searchValue parameter lets you pass the text to search for within the rangeObj.

You can pass the optional searchCondition parameter to specify how the search is performed. Les propriétés suivantes sont prises en charge :

PropriétéTypeDescription
afterColumnIntegerLe numéro de la colonne située juste avant la colonne de départ de la recherche. If the rangeObj is a combined range, the column number given must be from the first range. Default value: -1 (beginning of the rangeObj)
afterRowIntegerLe numéro de la colonne située juste avant la colonne de départ de la recherche. If the rangeObj is a combined range, the row number given must be from the first range. Default value: -1 (beginning of the rangeObj)
allBoolean
  • True - All cells in rangeObj corresponding to searchValue are returned
  • False - (default value) Only the first cell in rangeObj corresponding to searchValue is returned
  • flagsInteger
    vk find flag exact matchThe entire content of the cell must completely match the search value
    vk find flag ignore caseCapital and lower-case letters are considered the same. Ex: "a" is the same as "A".
    vk find flag noneno search flags are considered (default)
    vk find flag use wild cardsWildcard characters (*,?) can be used in the search string. Wildcard characters can be used in any string comparison to match any number of characters:
  • * for zero or multiple characters (for example, searching for "bl*" can find "bl", "black", or "blob")
  • ? for a single character (for example, searching for "h?t" can find "hot", or "hit"
  • These flags can be combined. For example: $search.flags:=vk find flag use wild cards+vk find flag ignore case
    orderInteger
    vk find order by columnsThe search is performed by columns. Each row of a column is searched before the search continues to the next column.
    vk find order by rowsThe search is performed by rows. Each column of a row is searched before the search continues to the next row (default)
    targetInteger
    vk find target formulaThe search is performed in the cell formula
    vk find target tagThe search is performed in the cell tag
    vk find target textThe search is performed in the cell text (default)

    These flags can be combined. For example:$search.target:=vk find target formula+vk find target text

    In the optional replaceValue parameter, you can pass text to take the place of any instance of the text in searchValue found in the rangeObj.

    Objet retourné

    La fonction retourne un objet de plage décrivant chaque valeur de recherche trouvée ou remplacée. Un objet de plage vide est retourné si aucun résultat n'est trouvé.

    Exemple 1

    Pour trouver la première cellule contenant le mot "Total" :

    var $range;$result : Object

    $range:=VP All("ViewProArea")

    $result:=VP Find($range;"Total")

    Exemple 2

    Pour trouver "Total" et le remplacer par "Grand Total" :

    var $range;$condition;$result : Object

    $range:=VP All("ViewProArea")

    $condition:=New object
    $condition.target:=vk find target text
    $condition.all:=True //Search entire document
    $condition.flags:=vk find flag exact match

    // Replace the cells containing only 'Total' in the current sheet with "Grand Total"


    $result:=VP Find($range;"Total";$condition;"Grand Total")

    // Check for empty range object
    If($result.ranges.length=0)
    ALERT("No result found")
    Else
    ALERT($result.ranges.length+" results found")
    End if