🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi.bazy-danych
Article #82550

IBX TIBOutputDelimitedFile i nie działający OnCalcFields

#82550
From: Tomek
Date: Thu, 13 Aug 2015 12:16
47 lines
2449 bytes
Witam,

Robię coś takiego (w skrócie):

  baza.toFile.FieldDefs.Clear;

  AnyField := TIBStringField.Create(baza.toFile);
  AnyField.FieldName := 'ANYTXT';
  AnyField.Calculated := True;
  AnyFieldield.DataSet := baza.toFile;

  myFieldsList := AnyField.FieldName;

  if baza.toFile.Active = TRUE then
    baza.toFile.Active := FALSE;

  with baza.toFile do
  begin
    SQL.Clear;
    SQL.Add(' SELECT ');
    SQL.Add(myFieldsList);   
    SQL.Add(' FROM ANYTABLE ');
    Prepare;
    Open; 
  end;

  OutputFile := TIBOutputDelimitedFile.Create;
    try
      OutputFile.ColDelimiter := ',';
      OutputFile.OutputTitles := TRUE;
      OutputFile.FileName := 'D:\temp\tmp.csv';
      baza.toFile.State
      baza.toFile.BatchOutput(OutputFile);
    finally
      OutputFile.Destroy;
    end;

toFile to TIBQuery ze zdefiniowanym zdarzeniem OnCalcFields. Podłączyłem na próbe TDBGrid przez DataSource i rzeczywiście dane textowe z selecta zmienił w DBGridzie. Natomiast w pliku nie mam wartości wyliczonej tylko to co jest faktycznie w tabeli.

procedure TDataModule.toFileCalcFields(DataSet: TDataSet);
begin
  DataSet.FieldByName('ANYTXT').AsString := 'asdfg'; // example
end;

Jak zmusić OutputFile by używał metody onCalcFields obiektu(toFile) ?

Ver IBX 5.06
Technical Details
Message-ID: <88cf6046-fd8f-4866-8f7c-b3b7d20549a4@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!se8no3153767igc.0!news-out.google.com!b31ni6368qge.0!nntp.google.com!y105no247567qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Received: by 10.70.41.102 with SMTP id e6mr34526983pdl.10.1439468189549;        Thu, 13 Aug 2015 05:16:29 -0700 (PDT)
X-Received: by 10.140.39.50 with SMTP id u47mr40686qgu.42.1439468189311; Thu, 13 Aug 2015 05:16:29 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!se8no3153767igc.0!news-out.google.com!b31ni6368qge.0!nntp.google.com!y105no247567qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.delphi.bazy-danych
Date: Thu, 13 Aug 2015 05:16:29 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.17.131.49; posting-account=IMbJgAoAAAAqjkpBFeDphwsLT1V4yodb
NNTP-Posting-Host: 83.17.131.49
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <88cf6046-fd8f-4866-8f7c-b3b7d20549a4@googlegroups.com>
Subject: IBX TIBOutputDelimitedFile i nie działający
 OnCalcFields
From: Tomek <szpliter@gmail.com>
Injection-Date: Thu, 13 Aug 2015 12:16:29 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit