Subject Re: [IBO] Problem with IB_GRIDS and Lookup Field
Author Helen Borrie
At 12:52 PM 24/06/2003 +0100, you wrote:

>Hello, at first time sorry for my english. I have a little problem with the
>ib_grid. there are two IB_Querys linked by keysource for get a lookup field
>in the first. The structure is like this
>
> Table Provider Table Conta
>
>Index Name Provider Total
>---------------------- -------------------
> 1 AAAA 1 1000
> 2 BBBB 2 3000
>
>I make a lookup field in the query for get the provider's name
>
>select provider,(select name from provider where
>Provider.index=Conta.provider) as Name,total
>from Conta
>
>I put this in a IB_GRIDs and all is ok. But when i insert a new record and
>i input the provider code the name don't refresh is blank until i close and
>reopen the query.There is any solution?

Yes. The correlated subquery (which you call a "lookup") needs your new
Conta record to be committed to the database and then to be queried, in
order to return the new value to Name in your output set. Make sure that
(a) the transaction isolation is tiReadCommitted and then (b) the inserted
row gets committed. Set the query's RefreshAction to raKeepDataPos.

After the Commit, call the Refresh method of the Conta dataset, and the
name should appear.

Refresh is usually more efficient than calling Close and Open, because the
dataset will retain the unchanged rows in the buffer and simply bring the
new row across.

Helen