[Lazarus] SQLite: How to create lookup fields?

Luiz Americo Pereira Camara luizmed at oi.com.br
Thu Dec 25 03:08:54 CET 2008


User escreveu:
> Hi, I have two TSQLite3Dataset components:
>
> DatasetSales with the fields: Code, Item, Amount, Price, Vendor
> DatasetItems with the fields: Code, Description
>
> I have a TDBGrid component that shows the data of DatasetSales.
>
> I want to make a lookup field associated to the Item DatasetSales 
> field to show the Code and Description DatasetItems fields.
>
> I do it:
>
> Code:
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
>   with DatasetSales do
>   begin
>   Open;
>   DatasetItems.Open;
>   FieldByName('Item').FieldKind := fkLookup;
>   FieldByName('Item').LookupDataSet := DatasetItems;
>   FieldByName('Item').LookupKeyFields := 'Code; Description';
>   FieldByName('Item').LookupResultField := 'Code';
>   end;
> end;
>
> but nothing happen.
>
> Why?

It's not implemented in TSqlite3Dataset. In fact i don't know in which 
layer (TDataset / TDataset descendant / TDbGrid) should be implemented.

It's up to TDataset descendants implement this?

Does some descendant already implemented ?

Luiz



More information about the Lazarus mailing list