Does unchecking "Match anywhere" work?

5 views
Skip to first unread message

Tamar Granor

unread,
Sep 8, 2022, 3:32:40 PM9/8/22
to GoFish
Has anyone had any success at filtering a search with the Match anywhere checkbox unchecked? I just tested a really simple case. I searched a project for a variable I knew was declared local in the project. Got results.

Then, in the Filter Builder, in the Within Same Statement textbox, I specified:

local

and applied. Got filtered down to the matches that are local declarations. Then, I went back into the Filter Builder and unchecked Match anywhere. Hit Apply and I get no matches at all.

In fact, every filter I've tried with that box unchecked returns no results. Am I misunderstanding what it's meant to do or have I found a bug?

Tamar

P.S. Sorry, Jim, this is what happens when I'm writing about something.

Jim Nelson

unread,
Sep 8, 2022, 3:39:37 PM9/8/22
to foxpro...@googlegroups.com
I can't help with this one.

Not sure you can call it a bug until you know what it's intended to do (and possibly nobody knows that any more).

Am curious what you expected it to do.

--
You received this message because you are subscribed to the Google Groups "GoFish" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foxprogofish...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/foxprogofish/4f13213e-fe2b-41ae-a30b-68fc5dd0fd24n%40googlegroups.com.


--
Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)

Tamar Granor

unread,
Sep 8, 2022, 3:52:48 PM9/8/22
to GoFish

I expected it to limit results to matches where the filter expression occurred at the beginning of the line. That’s partly from digging back through discussions here; the caption on that checkbox was switched along the way. You wrote this in 2016 in a thread titled "GoFish 5.0.146 Beta Update":

The four combinations of the two checkboxes at the bottom now work more naturally, and I believe only the combinations with "Use Wildcards" = .T. need any explanation:
  • Use Wildcards = .T. and Match Anywhere = .T. -- creates a phrase like this:
    • LIKE('*' + TextToFind + '*', TextToSearch)
  • Use Wildcards = .T. and Match Anywhere = .F. -- creates a phrase like this:
    • LIKE(TextToFind, TextToSearch)
Thus, using Match Anywhere = .F. lets you determine whether you want wildcards at the beginning or end of text to be searched for.


So I think that's what it's meant to do.

Tamar

Jim Nelson

unread,
Sep 8, 2022, 4:02:14 PM9/8/22
to foxpro...@googlegroups.com
Yup, mystifying.

You were searching with WildCards = .T.  ?  (I don't recall ever using this one.)

It seems to me that the code uses exact matching to the whole line if "match anywhere" is not selected.  For the life of me, I can't imagine a use for that.

Tamar Granor

unread,
Sep 8, 2022, 4:17:49 PM9/8/22
to GoFish
In my original testing, I wasn't using wildcards, but I checked it after I read your 2016 comment. It hadn't occurred to me that it meant an exact match of the whole line. Let me test that.

Hmm, looking at the actual filter expression (I'd forgotten I could see that--adding it to the paper). Looks like it's about being at the start of the whole procedure (for that expression), not just at the start of a line in the procedure.

((LIKE("LOCAL*",UPPER(ALLTRIM(PROCCODE,CHR(9),CHR(10),CHR(13)," ")))))

Okay, now that I see that, I can go back and play with the "within same statement" and see whether I can get it working.

Tamar

Tamar Granor

unread,
Sep 12, 2022, 3:24:41 PM9/12/22
to GoFish
Back to testing this and , even now, understand how it's supposed to work, I still see an issue. For a quick test, I ran a search and then set "Within same statement" to "m." It found matches on almost every line. The result set has a few lines with m. on the left-hand side of an equals, so I unchecked "Match anywhere" and it produces no results. When I look at the filter expression it's using, I get:

(("M."=UPPER(STATEMENT)))

That's never going to be true. So something in the filter-building code is messed up.

Tamar
Reply all
Reply to author
Forward
0 new messages