This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP Find next
|
WP Find next ( targetObj ; searchAfter ; searchValue ; searchCondition {; replaceValue} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element or 4D Write Pro document | |||||
searchAfter | Object |
![]() |
Range after which to begin searching | |||||
searchValue | String |
![]() |
Search value | |||||
searchCondition | Longint |
![]() |
Search rule(s) | |||||
replaceValue | String |
![]() |
Replacement string | |||||
Function result | Object |
![]() |
Range of the found/replaced value | |||||
The WP Find next command searches the targetObj, after the searchAfter range, for the searchValue based on the searchCondition. An optional parameter can be used to replace any results found.
Note: WP Find next does not search or replace text in formulas. Use the WP Get formulas command in this case.
In the targetObj parameter, pass an object containing:
Pass a range in the searchAfter parameter. The search will begin immediately after the range defined or pass NULL to find the first value of targetObj.
Note: If targetObj is the 4D Write Pro document and searchAfter is in a text box, the command searches occurences first in the parent text box and then in next text box(es) in ascending order -- according to the ordering described below.
The searchValue parameter lets you pass the text to search for within the targetObj.
You can specify how the search is performed with the searchCondition parameter. You can use one (or a combination) of the following constants:
Constant | Comment |
wk case insensitive | Strings are compared with no consideration of capitalization differences. Note that diacritical marks are taken into consideration. For example, "A" is considered the same as "a", however "a" is not considered the same as "à". |
wk diacritic insensitive | Strings are compared but the diacritical mark (e.g., accent or symbol) of letters is ignored. For example, "a" is considered the same as "à". |
wk find reverse | Search is performed in reverse order. |
wk kana insensitive | For Japanese language. Strings are compared according to the meaning (not the writing style). For example, "あ" is considered the same as "ア". When this option is set, wk width insensitive is implicit (considered set), however, the opposite is not true. |
wk keep character style | When replacing text, the existing character style is retained (if possible). |
wk override protected | Read/write protection is ignored and strings in protected areas can be replaced. |
wk use keyboard language | For string comparison, use the keyboard language property from the form object being edited instead of the current data language (default). Note: Ignored if the document is offscreen. |
wk whole word | Only strings that are complete words are considered. Matching strings within other strings are not considered. For example, "where" is not considered when found within "somewhere". |
wk width insensitive | For Japanese language. Strings are compared by character width. For example, "ア" is considered the same as "ア". |
Note: Strings are compared to the current data language unless wk use keyboard language is used.
In the optional replaceValue parameter, you can pass text to take the place of any instance of the text in searchValue found in the targetObj.
Returned Range
The function returns a range of the value that was found or replaced:
If targetObj is a range or element, found values are returned in the order they are found.
If targetObj is a 4D Write Pro document, found values are returned in the following order:
An empty range is returned if no results are found.
var $userSel ;$target ;$alphaRanges ;$nextRange : object
var $options : Integer
// define search options
$options:=wk case insensitive+wk diacritic insensitive
// get current user position
$userSel:=WP Selection range(*;"WParea")
// define target
$target:=WP Get body(WParea) // search only inside the body
// launch SEARCH of NEXT occurence of the "alpha" string (based on current selection)
$nextRange:=WP Find next($target;$userSel;"alpha";$options)
Product: 4D
Theme: 4D Write Pro Language
Number:
1764
Created: 4D v19
4D Write Pro Reference ( 4D v20 R7)