Subject |
Re: Rowset Navigation |
From |
Ken Mayer <dbase@nospam.goldenstag.net> |
Date |
Sun, 23 Jun 2019 11:12:31 -0700 |
Newsgroups |
dbase.getting-started |
On 6/23/2019 1:33 AM, Mustansir Ghor wrote:
> Dear All
>
> Consider the below syntax
>
> this.QLABRESG = new QUERY(this)
> with (this.QLABRESG)
> left = 150.0
> database = form.dopd
> sql = "select l.sno,l.item,r.resulty from labres l join laborat r on l.item=r.code where l.resultc is null and l.resultm is null and r.machine=:tmachine "
> params["tmachine"] = ""
> active = true
> endwith
>
> with (this.QLABRESG.rowset)
> onNavigate = class::ROWSET_ONNAVIGATE
> endwith
>
>
>
> this.QLABREST = new QUERY(this)
> with (this.QLABREST)
> left = 150.0
> database = form.dopd
> sql = "select * from labres where sno=:sno and item=:item "
> params["sno"] = ""
> params["item"] = ""
> masterSource = form.qlabresg.rowset
> active = true
> endwith
>
> with (this.QLABREST.rowset)
> indexName = "sno"
> endwith
>
>
> function rowset_onNavigate(type, nRows)
> local mresultc,mresultm
> gref = this.parent.parent
> gref.lbtestname.text="R.No"+this.fields["sno"].value
> gref.etext.visible=false
> gref.cblogical.visible=false
> gref.EDmemo.visible=false
> gref.etext.enabled=true
> gref.cblogical.enabled=true
> gref.EDmemo.enabled=true
> gref.lbunit.visible=false
> mresultc=''
> mresultm=''
>
>
> mresultc = gref.qlabrest.rowset.fields["resultc"].value
> mresultm = gref.qlabrest.rowset.fields["resultm"].value
> ?mresultc,mresultm
> do case
> case gref.qlabresg.rowset.fields["resulty"].value="M"
> gref.EDmemo.visible=true
> if empty(mresultm)
> gref.edmemo.value=""
> gref.edmemo.setfocus()
> else
> gref.edmemo.value = mresultm
> gref.edmemo.enabled=false
> endif
>
> case gref.qlabresg.rowset.fields["resulty"].value="L"
> gref.cblogical.visible=TRUE
> if empty(mresultc)
> gref.cblogical.value=""
> gref.cblogical.setfocus()
> else
> gref.cblogical.value = mresultc
> gref.cblogical.enabled=false
> endif
>
> case gref.qlabresg.rowset.fields["resulty"].value="N"
> gref.lbunit.text=this.fields["unit"].value
> gref.lbunit.visible=true
> gref.etext.visible=true
> if empty(mresultc)
> gref.etext.value=0.000
> gref.etext.setfocus()
> else
> gref.etext.value=ltrim(mresultc)
> gref.etext.enabled=false
> endif
>
> endcase
>
> return
>
> 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.
Have you tried a call to the rowset's refreshControls() method?
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
|
|