Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread "Find next"
Mon, Feb 20 2006 11:59 AMPermanent Link

I've got to implement a find facility in our app, and the basics are easy.
Show the fields in a combo box, allow a value to be entered, and then do a
query to find the record ID of the first response. Then move the grid to
that record. I can do this using SQL or a table.

But I can't work out how to do "find next", given that this is just a
button to press and I could have a million matching records. Is there a
way to query the first of something after a particular record?

A sort of "SELECT * WHERE Column = "Mickey" AFTER RecordID = LastRec"

Suggestions welcome!

/Matthew Jones/
Mon, Feb 20 2006 12:40 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< But I can't work out how to do "find next", given that this is just a
button to press and I could have a million matching records. Is there a way
to query the first of something after a particular record?

A sort of "SELECT * WHERE Column = "Mickey" AFTER RecordID = LastRec" >>

There's really no way to do it with one query since DBISAM doesn't support
specifying a range of records to return from the query result set.  You'll
have to basically execute the query and then use the TDBISAMQuery
First..Next methods to navigate to the desired record.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 20 2006 1:21 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Matthew


There are a couple of possible approaches depending on exactly what you're doing and what you want to do. I need a bit more info.

I'm guessing, for instance, that you're displaying an unfiltered copy of the table in the grid. Is that right? Also I'm guessing that the query will return more than one record and that you're jumping to the first record in the query and you want to go to the next in the query. Or is it that you want to go to the "next" possible in the criteria? Or what?

Roy Lambert
Mon, Feb 20 2006 3:51 PMPermanent Link

Yes, it is a grid, and I'm allowing someone to "search" it while not
hiding any records (not a filter). I'm actually wanting to do what the
Woll2Woll search dialog did, but we don't use that any more. First finds
the first, and next finds the subsequent ones. From Tim's response, it
looks like a simple query and first/next is going to be the answer.

/Matthew Jones/
Mon, Feb 20 2006 5:32 PMPermanent Link

Jeff Cook
matthew@matthewdelme-jones.delme.com (Matthew Jones) wrote on Mon, 20 Feb 2006 20:50 +0000 (GMT Standard Time)

>Yes, it is a grid, and I'm allowing someone to "search" it while not
>hiding any records (not a filter). I'm actually wanting to do what the
>Woll2Woll search dialog did, but we don't use that any more. First finds
>the first, and next finds the subsequent ones. From Tim's response, it
>looks like a simple query and first/next is going to be the answer.
>
>/Matthew Jones/
Matthew


1. Show the table (or query) in your grid.
2. Do a query with your selection criteria
3. In the query's AfterScroll, do a FindKey on the table for the same record
4. Make your <Next> key to a Next on the query.


Cheers

Jeff

P.S.  You could also make your query go into a memory table and use that in a lookup field for the table in the grid.  That way you can use the grid drawing events to highlight the selected items and make it look pretty!

--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Feb 21 2006 4:29 AMPermanent Link

Ooh - perfect solution. Many thanks.

/Matthew Jones/
Wed, Mar 1 2006 1:58 PMPermanent Link

I have come across another solution.

I have a TBISAMTable as the source for a grid.
If I set the table's Filter property according to the user's "find" criteria,
e.g. 'UPPER(Surname) LIKE UPPER(Smith%)', but leave the table's Filtered
property set to false, then even though I am showing an unfiltered version of
the table in the grid, the FindFirst, FindNext, FindLast, and FindPrior
procedures take the filter property into account.

So, I could be viewing a live grid sorted by company name, then find the
first company where the contact name is Smith or Smithson, then go on to the
next Smith, and so on (and backwards too).

Basically, what I am doing is emulating what Paradox does for a Ctrl-Z and
Ctrl-A, for the benefit of someone who is used to Paradox.

The only fly in the ointment is that Paradox can set a filter and
simultaneously do a Find / Find next.  I can't emulate that using the above.

--Bill Sparrow--


In article <memo.20060221092847.596B@nothanks.nothanks.co.uk>,
matthew@matthewdelme-jones.delme.com (Matthew Jones) wrote:

> *Subject:* Re: "Find next"
> *From:* matthew@matthewdelme-jones.delme.com (Matthew Jones)
> *Date:* Tue, 21 Feb 2006 09:28 +0000 (GMT Standard Time)
>
> Ooh - perfect solution. Many thanks.
>
> /Matthew Jones/
>
Wed, Mar 1 2006 3:56 PMPermanent Link

It would be interesting to know if that is a designed feature, or a quirk.
It looks good if designed.

/Matthew Jones/
Thu, Mar 2 2006 6:04 AMPermanent Link

Designed in.  I found it from reading the help!

--Bill Sparrow--


Thu, Mar 2 2006 6:42 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Bill

>Designed in. I found it from reading the help!

That's cheating!

Roy Lambert
Image