Re: TZF -

Robin Dudley <[email protected]>
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
Jerry

re the date query try this calling procedure, it is for setwhileto() not 
setfilterto() as it is much quicker..

this is a generic procedure to call....

procedure TChloeLogMain.setit(d:ttzdbf; myfield: ttzfieldname; atag: 
string; datewhile : string; finditkey : string);
begin
waitform.visible := true;
waitform.label2.caption := 'Please Wait - Searching';
application.processmessages;
screen.cursor := crhourglass;
d.disablecontrols;
mylength := length(d.getfield(myfield));
          while length(finditkey) < mylength do
          finditkey := finditkey + ' ';
datefound := false;
d.setwhileto('');
d.gotop;
d.setordertotag(atag);
          if d.find(finditkey) then
          begin
          datefound := true;
          curdate := CTOD(d.getfield('DATED'));
          while (curdate < date1) or (date2 < curdate) do begin
          d.skip(1);
if (d.deof) or (d.getfield(myfield) <> finditkey) then
             begin
             datefound := false;
             break;
             end;
             curdate := CTOD(d.getfield('DATED'));
             end;
             end;
if datefound then
d.setwhileto(datewhile)
else begin
      d.gotop;
      notfound;
      end;
d.enablecontrols;
waitform.hide;
screen.cursor := crdefault;
end;


then use something like this to call it
this searches for a text field between 2 dates

inputstring := methodselect.text;
setit(dm.controldata,'METHOD','METHOD','(METHOD = "'+inputstring+'") .and. 
("'+date1+'" <= DTOS(DATED)) .and. (DTOS(DATED) <= "'+date2+'")',inputstring);
end;


At 22:39 05/02/2003, you wrote:
>Ok Guys ... my original question/query again and a new one.
>
>Extremely dissapointed at the lack of responses to my first question
>which for some of you guys I thought would have been a breeze.
>
>But here goes again.
>
>Original Question First
>------------------------
>Looking to filter a database on a date field. Is this possible. I'm
>having trouble doing so.
>SFilter being a string input date in the format 18/10/1953
>UK/Ireland date format.
>Competitors.SetFilterTo('DATES == "'+CTOD(SFilter)+'"');
>This line above does not work no matter what way I type it.
>
>Have tried the DTOC function as well as Marie suggested. No Good.
>---------------------------------------------
>2nd Question.
>------------
>Create a procedure
>Procedure DoThis;
>Begin
>End;
>
>And you can call it easily enough by just entering DoThis;
>
>Procedure DoThat;
>Begin
>// call procedure
>   DoThis;
>End;
>
>
>OK Now my question. Button on forum and create an event like so
>  // silly example but I hope you get the jist of what I mean.
>
>procedure TForm1.DBFData1Click(Sender: TObject);
>begin
>   SalesForm.SalesDBF.AppendFrom('mydata.dbf');
>end;
>
>Then write a procedure like so
>
>procedure TForm1.ImportBtnClick(Sender: TObject);
>begin
>    case TzDialogBox('Import Utility','?','Select Data Type To Import',
>                     'DBF CSV Abort') Of
>      'd','D' : ; // TForm1.DBFData1Click;
>      'c','C' : ; // TForm1.CSVData1Click(Sender: TObject);
>      'a','A' : Exit;
>    end; // case
>end;
>
>This don't work so I'm wondering how do we call a procedure created by a
>button event.
>
>Anybody help!  Please
>
>Many thanks in advance
>
>Jerry
>

Cheers

Robin

[email protected]
http://www.robin-dudley.co.uk 

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.