Subject Re: [IBO] IB_Import
Author Harald Klomann
Hi Bert,

IB_Import was not designed to fill columns
of a table which does not occur in the ascii-file.
However, there is one thing you can do :

1.) Setup your IB_Import as usual.

2.)Setup a IB_Query or better, a IB_DSql with the
appropriate insert statement including all the
columns, you want to populate with values - whether
they occur in the ascii-file or not. Also setup
the transaction for it or use your main transaction.

3.) let IB_Import parse your ascii-file as usual,
and in the IB_Import1PrePost event you setup the
column values of your IB_Dsql. The column values found
in the ascii-file, are stored in ARow. Columns not
found in the ascii-file, you set here manually.
Finally, set OkToPost to false. This means, that IB_Import
doesn´t insert the current row. Instead,you post your IB_Dsql.
That will do it.

procedure TForm1.IB_Import1PrePost(Sender: TObject; var ARow: TIB_Row;
var OkToPost: Boolean);
begin
OkToPost := false;
with IB_Dsql do begin
Insert;
FieldByName('AName').Value := ARow.ByName("AName").Value;
..
..
FieldByName('AsciiFileName').Value := IB_Import.AsciiFile;
Post;
end;
end;


Hope this helps !
Good luck,
Harald Klomann






Bert Neef schrieb:
>
> Hi,
>
> I am using a IB_Import to parse a ascii file, everything goes allright but
> one column in the destination table isn't represented in the ascii file but
> it should contain the name of the ascii file used. I can't seem to get this
> to work (I tried using a row.byname in the PrePost event but that returns
> an error that the column isn't found)
>
> Any ideas?
>
> Thanks in advance,
>
> Bert Neef
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/