Hi
I am wondering is there any scan or search function which searches for perticular key word .
Like i want to populate all data which matches with 'ADDED XXX' in a column.
THKS
search function
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 385
- Joined: Wed Jun 16, 2004 12:43 pm
- Location: Virginia, USA
- Contact:
Take a look at the Index() function. It will return a non-zero value if the substring you are searching for is found in the string.
Chuck Smith
www.anotheritco.com
www.anotheritco.com
That non-zero value that Index() returns is actually the starting position of the sub-string if it is found. The nice thing about that is, if you don't care where the sub-string is found but only if it is found, you can use that as a boolean. For example:
If 'ADDED' is not found in the column it will return a zero which is interpreted as False. And since any non-zero value evaulates to 'true', the starting position of the sub-string can be leveraged as indicated.
Hope that helps,
Code: Select all
If Index(Link.Column,'ADDDED',1) Then <do something> Else < do something else>
Hope that helps,
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Try:
gateleys
Code: Select all
If(InLink.Column MATCHES "0x'ADDED'0x") Then someValue Else otherValue
The INDEX function is used frequently and has been very well tuned. It is also (algorithmically) quite a simple linear search for a substring so is easy to implement. The MATCHES function is much a more complex pattern matching function which has to parse the picture string into it's components and then search the string for all components to match. You should use MATCHES or MATCHFIELD or the other pattern matches when a simple INDEX doesn't suffice.
Your matches idea was good, I just wanted to make sure that it was understood that there is a price to pay for that flexibility.
Your matches idea was good, I just wanted to make sure that it was understood that there is a price to pay for that flexibility.