Saltar para o conteúdo principal
Versão: Próximo

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

ParâmetroTipoDescrição
rangeObjObject->Objeto intervalo
searchValueText->Valor da pesquisa
searchConditionObject->Objeto que contém condição(ões) de pesquisa
replaceValueText->Valor de substituição
ResultadosObject<-Objeto intervalo

Descrição

O comando VP Find pesquisa o rangeObj para o searchValue. Podem ser utilizados parâmetros opcionais para refinar a pesquisa e/ou substituir quaisquer resultados encontrados.

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. As propriedades abaixo são compatíveis:

PropriedadeTipoDescrição
afterColumnIntegerO número da coluna imediatamente anterior à coluna inicial da pesquisa. If the rangeObj is a combined range, the column number given must be from the first range. Default value: -1 (beginning of the rangeObj)
afterRowIntegerO número da linha imediatamente anterior à linha inicial da pesquisa. If the rangeObj is a combined range, the row number given must be from the first range. Default value: -1 (beginning of the rangeObj)
allParâmetros
  • 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 (*,?) pode ser usado na string de pesquisa. 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.

    Objecto devolvido

    A função retorna um objeto de intervalo que descreve cada valor de pesquisa que foi encontrado ou substituído. É devolvido um objeto de intervalo vazio se não forem encontrados resultados.

    Exemplo 1

    Para encontrar a primeira célula que contém a palavra "Total":

    var $range;$result : Object

    $range:=VP All("ViewProArea")

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

    Exemplo 2

    Para encontrar "Total" e substituí-lo por "Total geral":

    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