RefreshRecord problem

maxclot

Member
Delphi 5.01 and DOA 3.4.5
After a RefreshRecord, Oracle dataset points to another row!

This is the SQL property of my Oracle dataset:
===============
SELECT OA.*, OA.ROWID, AZ.DESCRIZIONE AS DescrTit, DIV.DESCRIZIONE AS DescrDivTit, AZ.DIVISA AS DivTit, AZ.DIVISA_REGOLAMENTO AS DivRegTit, AZ.CODICE_ISIN As ISIN, DVS.DESCRIZIONE AS DescrDivRegol, CNT.DESCRIZIONE AS DescrControp, AZ.EMITTENTE AS EmittTit, AZ.FLAG_TITOLO_ESTERO AS TitoloEstero, DECODE(OA.TIPO_OPERAZ, 1, 'S', 2, 'OP', 3, 'OM') As Status, DECODE(OA.CAUSALE, 'AP', 'Acq.', 'AT', 'Acq.fwd', 'VP', 'Vend.', 'VT', 'Vend.fwd') As Segno
FROM ORDINI_TIT_AZIONARI OA,
TIT_AZ AZ,
DIVISE DIV,
DIVISE DVS,
CONTROP CNT
WHERE (AZ.CODICE_INTERNO(+) = OA.CODICE_TITOLO_INTERNO) AND
(DIV.DIVISA(+) = AZ.DIVISA) AND
(DVS.DIVISA(+) = AZ.DIVISA_REGOLAMENTO) AND
(CNT.CONTROPARTE(+) = OA.CONTROPARTE)
ORDER BY OA.ID_ORDINE DESC
================

The table has a primary key on ID_ORDINE.

Any idea?
Thanks
 
I've recently had a similar experience. I found that it had something to do with the use of a DBLookupComboBox. Opening and using the LookupCombobox results in an internal look-ahead to show the next few records. This results in the fact that ROWID does not correspond anymore to the current record. RefreshRecord uses this ROWID to fetch the record. As a workaround I use the LOCATE method to locate the current record. I hope this information is of any use to you.

The only thing I don't know is whether this is a bug in DOA or in the DBLookupCombobox.
Marco, what do you think?

Bert Hardeman
 
More info.
I have 3 InfoPower grids with a master-detail-detail configuration (3 levels).
Actually I also have a panel to insert/edit data in the master dataset using InfoPower DBLookupCombo, anyway the problem arises even without using this insert/edit form.
I allow to multiselect rows in the grid, then, pressing a function key, I cycle on the selected rows doing something on each row. Inside this 'something' there is the Master.RefreshRecord call causing my problem.
I could refresh the whole master dataset and then locate the row I need, but this is quite heavy on large dataset and/or large multiselected rows. Maybe you use the Locate method before calling RefreshRecord?

I thought it was a problem of my dataset query, maybe too complex to use RefreshRecord method (see DOA help file).
How did you determine the DBLookupCombo involvement?

Massimo Clot
 
>>How did you determine the DBLookupCombo involvement?

I looked at the record which was returned after the REFRESHRECORD. I noticed it to be the last record shown in the DBLookupCombo when you open it.

Here is my workaround:

Showmessage(OracleDatasetIDFIELD.AsString+'>> '+OracleDataset.RowId);
OracleDataset.Locate('IDFIELD',OracleDatasetIDFIELD.AsString,[]);
OracleDataset.RefreshRecord;
Showmessage(OracleDatasetIDFIELD.AsString+'>> '+OracleDataset.RowId);

Internally the DOA component stores the ROWID of the current record. This ROWID is used to refresh the current record (using REFRESHRECORD).

I suspect the following is going wrong: when you OPEN a DBLookupCombo, the component has to look ahead for the information of the next set of records in the dataset. This triggers the change of the ROWID, causing the refreshrecord to go wrong. If you don't open the DBLookupCombo the refreshrecord gives the correct result.

In the workaround I locate the currect record again (before calling RefreshRecord) as this will set ROWID to the correct value again.

I use RxDBLookupCombo. You use InfoPower DBLookupCombo. Both are probably descendant of TDBLookupCombobox. This all could mean that it is actually a bug in DOA.
Marco, what do you think?

Bert Hardeman
 
Back
Top