Home > Archive > FoxPro Help and Support > May 2005 > find aword amound the field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author find aword amound the field
bijan

2005-04-30, 11:26 am

Hi
I have a table with one field and 100 record
I want brows this table for word for example book.
This word maybe in the first or middle or end of field what must I do
Thank you for your help

Josh Assing

2005-04-30, 11:26 am


browse for "word"$fieldname

On Sat, 30 Apr 2005 07:50:01 -0700, "bijan" <bijan@discussions.microsoft.com>
wrote:

>Hi
>I have a table with one field and 100 record
>I want brows this table for word for example book.
>This word maybe in the first or middle or end of field what must I do
>Thank you for your help



---
Remove x's to send.
Olaf Doschke

2005-04-30, 11:26 am

> This word maybe in the first or middle or end of field what must I do

browse for "word" $ field
or
browse for upper("word") $ upper(field)
what would of course be the same as
browse for "WORD" $ upper(field)

Bye, Olaf.



Mark McCasland

2005-04-30, 1:26 pm

I know you said "browse", but here is an example SQL version:

select * from Mytable where lower(MyField) LIKE '%book%' order by MyField
into cursor crsResults

"bijan" <bijan@discussions.microsoft.com> wrote in message
news:269009EE-ABE3-4A17-85F8- F85E23DC9D1A@microso
ft.com...
> Hi
> I have a table with one field and 100 record
> I want brows this table for word for example book.
> This word maybe in the first or middle or end of field what must I do
> Thank you for your help
>



Fred Taylor

2005-04-30, 8:26 pm

And to add yet another way:

BROWSE FOR (ATC("word",field)>0)

This allows the word to be exist in the field in any case (upper or lower or
mixed).

--
Fred
Microsoft Visual FoxPro MVP


"bijan" <bijan@discussions.microsoft.com> wrote in message
news:269009EE-ABE3-4A17-85F8- F85E23DC9D1A@microso
ft.com...
> Hi
> I have a table with one field and 100 record
> I want brows this table for word for example book.
> This word maybe in the first or middle or end of field what must I do
> Thank you for your help
>



Roger Ansell

2005-05-01, 9:26 am

Fred Taylor <ftaylor@mvps.org!REMOVE> wrote:
> And to add yet another way:
>
> BROWSE FOR (ATC("word",field)>0)
>
> This allows the word to be exist in the field in any case (upper or
> lower or mixed).


Well, not exactly!
What is a "word"?

?ATC("world","worldish myworld anotherworld") >0

That returns .T. but the unique word "world" doesn't exist
in the searched expression. The character sequence
"world" does, which is why ATC() >0 returns .T.

Maybe that's what the original poster wants, maybe not.
Probably not.

If not, you must define what constitutes a word
using delimiters. It's up to you what delimiters are
acceptable.

lcDelimiters = ".,[]{};:!@#$%^&*()-_+=:;"'<>?/\|" + Space (1)
lnLenDelims = Len(lcDelimiters)

lcSearched =ChrTran(<whatever>, lcDelims, Space(lnLenDelims))

lcMyWord = " world " && space before and after

?ATC(<whatever> , lcMyWord) > 0

-Roger
--
Roger Ansell
Adelaide, Australia

My real email address is ransell (at) senet dot com dot au
[color=darkred]
>
> "bijan" <bijan@discussions.microsoft.com> wrote in message
> news:269009EE-ABE3-4A17-85F8- F85E23DC9D1A@microso
ft.com...



Roger Ansell

2005-05-01, 11:26 am

Sorry ...

lcSearched =ChrTran(<whatever>, lcDelims, Space(lnLenDelims))

lcMyWord = " world " && space before and after

?ATC(lcSearched, lcMyWord) > 0


--
Roger Ansell
Adelaide, Australia

My real email address is ransell at senet dot com dot au

"Roger Ansell" < notmyreal@emailaddre
ss.com> wrote in message
news:Owq1holTFHA.2556@TK2MSFTNGP12.phx.gbl...
Fred Taylor <ftaylor@mvps.org!REMOVE> wrote:
> And to add yet another way:
>
> BROWSE FOR (ATC("word",field)>0)
>
> This allows the word to be exist in the field in any case (upper or
> lower or mixed).


Well, not exactly!
What is a "word"?

?ATC("world","worldish myworld anotherworld") >0

That returns .T. but the unique word "world" doesn't exist
in the searched expression. The character sequence
"world" does, which is why ATC() >0 returns .T.

Maybe that's what the original poster wants, maybe not.
Probably not.

If not, you must define what constitutes a word
using delimiters. It's up to you what delimiters are
acceptable.

lcDelimiters = ".,[]{};:!@#$%^&*()-_+=:;"'<>?/\|" + Space (1)
lnLenDelims = Len(lcDelimiters)

lcSearched =ChrTran(<whatever>, lcDelims, Space(lnLenDelims))

lcMyWord = " world " && space before and after

?ATC(<whatever> , lcMyWord) > 0

-Roger
--
Roger Ansell
Adelaide, Australia

My real email address is ransell (at) senet dot com dot au
[color=darkred]
>
> "bijan" <bijan@discussions.microsoft.com> wrote in message
> news:269009EE-ABE3-4A17-85F8- F85E23DC9D1A@microso
ft.com...




Fred Taylor

2005-05-01, 8:28 pm

Not always, as if it's the beginning of the string, or the end of a string,
you may still may not find it.

It all depends.

--
Fred
Microsoft Visual FoxPro MVP


"Roger Ansell" < notmyreal@emailaddre
ss.com> wrote in message
news:%23l1gLZmTFHA.3056@TK2MSFTNGP14.phx.gbl...
> Sorry ...
>
> lcSearched =ChrTran(<whatever>, lcDelims, Space(lnLenDelims))
>
> lcMyWord = " world " && space before and after
>
> ?ATC(lcSearched, lcMyWord) > 0
>
>
> --
> Roger Ansell
> Adelaide, Australia
>
> My real email address is ransell at senet dot com dot au
>
> "Roger Ansell" < notmyreal@emailaddre
ss.com> wrote in message
> news:Owq1holTFHA.2556@TK2MSFTNGP12.phx.gbl...
> Fred Taylor <ftaylor@mvps.org!REMOVE> wrote:
>
> Well, not exactly!
> What is a "word"?
>
> ?ATC("world","worldish myworld anotherworld") >0
>
> That returns .T. but the unique word "world" doesn't exist
> in the searched expression. The character sequence
> "world" does, which is why ATC() >0 returns .T.
>
> Maybe that's what the original poster wants, maybe not.
> Probably not.
>
> If not, you must define what constitutes a word
> using delimiters. It's up to you what delimiters are
> acceptable.
>
> lcDelimiters = ".,[]{};:!@#$%^&*()-_+=:;"'<>?/\|" + Space (1)
> lnLenDelims = Len(lcDelimiters)
>
> lcSearched =ChrTran(<whatever>, lcDelims, Space(lnLenDelims))
>
> lcMyWord = " world " && space before and after
>
> ?ATC(<whatever> , lcMyWord) > 0
>
> -Roger
> --
> Roger Ansell
> Adelaide, Australia
>
> My real email address is ransell (at) senet dot com dot au
>
>
>
>
>



Josh Assing

2005-05-02, 3:25 am

How's this for a "solve all"....



browse for isthere(MyMemoField,
"word")



#DEFINE WordBreaks ". ;,'"
FUNCTION IsThere
LPARAMETERS tcSearched, tcWord
LOCAL x, llReturn

llReturn = .F.

FOR x = 1 TO GETWORDCOUNT(tcSearc
hed,WordBreaks)
IF LOWER(GETWORDNUM(tcS
earched,x,WordBreaks
))==LOWER(ALLTRIM(tc
Word))
llReturn = .T.
EXIT
ENDIF
ENDFOR
RETURN llReturn
ENDFUNC



---
Remove x's to send.
Fred Taylor

2005-05-02, 11:24 am

Looks like that covers the bases.

--
Fred
Microsoft Visual FoxPro MVP


"Josh Assing" <xjoshx@jassing.com> wrote in message
news:2pcb71pntcujmqi
8bre9k9m0dhnickifii@
4ax.com...
> How's this for a "solve all"....
>
>
>
> browse for isthere(MyMemoField,
"word")
>
>
>
> #DEFINE WordBreaks ". ;,'"
> FUNCTION IsThere
> LPARAMETERS tcSearched, tcWord
> LOCAL x, llReturn
>
> llReturn = .F.
>
> FOR x = 1 TO GETWORDCOUNT(tcSearc
hed,WordBreaks)
> IF LOWER(GETWORDNUM(tcS
earched,x,WordBreaks
))==LOWER(ALLTRIM(tc
Word))
> llReturn = .T.
> EXIT
> ENDIF
> ENDFOR
> RETURN llReturn
> ENDFUNC
>
>
>
> ---
> Remove x's to send.



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com