Subject Re: Rowset Navigation
From Mervyn Bick <invalid@invalid.invald>
Date Mon, 24 Jun 2019 11:20:43 +0200
Newsgroups dbase.getting-started

On 2019-06-23 10:33 AM, Mustansir Ghor wrote:
> Dear All
>
> Consider the below syntax
......
>
> In the above syntax all works well except one issue. the mresultc,mresultm which takes data from qlabrest (I verified with ? in command window) but when  is is stored in appropiate control, the control  displays data from the previous record.
>
> to reconfirm the content I even displayed qlabrest in the grid.
>
> Can anybody point the error. May I have misconception of mastersource.

I'm a bit late to the party but we were without electricity for over 11
hours yesterday. :-(

MasterSouce is really meant to be used with tables held on a SQL server.
  As the rowpointer moves through the parent table the child table is
requeried automatically to fetch only the appropriate records from the
child table.  If there could be multiple child records for a given
parent record then one would use an ORDER BY clause in the child query.

While one can use masterSource with .dbf tables the appropriate dBASE
method is masterRowset/masterFields.  Here the child table must be
indexed on the masterFields.

It is never a good idea to mix SQL commands with dBASE commands.  You
have used an index to order the child table.  Internally masterSource is
fetching a new child rowset as each record in the parent table is
selected.  It is quite possible that the index is not used or is not
appropriate for the new rowset and this is giving rise to the problem.
If you use masterRowset/masterFields dBASe will not fetch a new rowset
but will use the the existing rowset's setRange() method to display the
required child records.

I suggest that you drop

    with (this.QLABREST.rowset)
       indexName = "sno"
    endwith

and use

sql = "select * from labres where sno=:sno and item=:item order by sno "

Mervyn.