Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 9 of 9 total |
display button indicators for records. |
Tue, May 2 2006 11:49 PM | Permanent Link |
Aaron Taylor | couldnt think of an appropriate discription but heres what i want to do.
i have 26 buttons a to z i want to enable / disable the buttons depending on wether there are records starting with the same letter. i thought of using select distinct then scanning through the result and enabling the buttons. but this would have to be done every post, delete and edit and may be to recorce hungry. does anyone have any input? dbisam 4 delphi 7 thanx |
Wed, May 3 2006 2:58 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Aaron
Can you give a bit more (or a lot more) information. My initial reaction was to have an extra table - 26 rows which has a count field showing how many records start with each letter. That's a bit of work keeping up to date but would be faster than continually using sql, but it might not suit your app. Roy Lambert |
Thu, May 4 2006 1:19 AM | Permanent Link |
Aaron Taylor | the buttons a to z set a filter to only show records starting with that letter.
i just want the buttons enabled if there are records that suit. Roy Lambert <roy.lambert@skynet.co.uk> wrote: Aaron Can you give a bit more (or a lot more) information. My initial reaction was to have an extra table - 26 rows which has a count field showing how many records start with each letter. That's a bit of work keeping up to date but would be faster than continually using sql, but it might not suit your app. Roy Lambert |
Thu, May 4 2006 4:04 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Aaron
All I can suggest is: 1. a separate table, where you increment and decrement records starting with the appropriate letter 2. have an extra field in the database and store the initial letter in there. Index the field then it will be fast to test for each letter. 3. If the field itself is indexed it might be fast to do a FindNearest And I'd use a TDBISAMTable rather than a TDBISAMQuery Otherwise unless someone comes up with a brilliant idea I think you'll just have to take the time penalty. Roy Lambert |
Thu, May 4 2006 7:33 AM | Permanent Link |
"Robert" | "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:4C8DF9BF-F779-4B79-9153-154609D899A4@news.elevatesoft.com... Either this select distinct substring(FIELD from 1 for 1) as letter from TABLE order by letter or this procedure TForm1.Button1Click(Sender: TObject); var j : integer; c : char; begin memo1.Clear; DBISAMTable1.Open; for j := 1 to 26 do begin c := char(j + 64); if DBISAMTable1.Locate('FIELD', c, [loPartialKey]) then memo1.Lines.Add(c); end; end; are pretty fast, though the loop using a tTable is much faster. My table already contains a string field in uppercase that is used to sort by name. Robert |
Thu, May 4 2006 8:06 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Robert
That's the sort of thing I was thinking of. Roy Lambert |
Thu, May 4 2006 8:21 PM | Permanent Link |
Aaron Taylor | thanx guys.
|
Tue, May 9 2006 9:43 PM | Permanent Link |
Aaron Taylor | "Robert" <ngsemail2005withoutthis@yahoo.com.ar> wrote:
"Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:4C8DF9BF-F779-4B79-9153-154609D899A4@news.elevatesoft.com... Either this select distinct substring(FIELD from 1 for 1) as letter from TABLE order by letter or this procedure TForm1.Button1Click(Sender: TObject); var j : integer; c : char; begin memo1.Clear; DBISAMTable1.Open; for j := 1 to 26 do begin c := char(j + 64); if DBISAMTable1.Locate('FIELD', c, [loPartialKey]) then memo1.Lines.Add(c); end; end; are pretty fast, though the loop using a tTable is much faster. My table already contains a string field in uppercase that is used to sort by name. Robert |
Tue, May 9 2006 10:11 PM | Permanent Link |
Aaron Taylor | For those who want to know how its done heres how.
Thanx to Robert For his code snippet. Var MyBtn: Array[1..26] of TButton; MyBtn[1]:=ButtonA; . . repeat to z . . MyBtn[26]:=ButtonB; procedure SetButtons; var j : integer; c : char; begin With DBISAMTable Do begin DisableControls; for j := 1 to 26 do begin c := char(j + 64); MyBtn[j].Enabled:= Locate('FIELD', c, [loPartialKey]); end; EnableControls end; end; |
This web page was last updated on Friday, September 20, 2024 at 05:39 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |