Subject Re: beginappend() Problem
From Peter <Phb2020@hotmail.com>
Date Wed, 28 Jun 2023 09:59:46 -0400
Newsgroups dbase.getting-started

Akshat Kapoor Wrote:

> Good Afternoon Peter,
>
> > I am having a problem with beginappend() which is called if user needs to enter data for sending bill to someone other than the patient.  If there a prior listing for this information, all works fine:  existing data is used for datalink of billtotest.wfm.
> > However, if there is no prior listing, i.e. no rowset for patient ID, form.rowset.beginappend() does not present user with a blank form.  (Based on OLH, I used beginAppend() Example to carry over to the billtotest.wfm.  This does not work.)
> >
> > Of interest is that msgbox for rowset.state is 1 (browse), not 2 (edit) in the first circumstance where prior rowset is found by findkey().
> > If there is no rowset found for existing data, a msgbox for rowset.state does not show 3 (append), but shows 1.
> >
> > So your help would be greatly appreciated.  I hope there is only a small error.
>
> The issue of implicit calls etc can be a tough one to debug.
>
> My code in this situation would be
>
>         FUNCTION RB_BILLTOOTHER_onRMD
>                 set procedure to billtotest.wfm
>                 form.billtotest = new billtotestForm()
> -                form.billtotest.my_pat_no = cpat_no
>                 form.billtotest.mdi = false
>                 form.billtotest.readmodal()
>         return
>
>         FUNCTION BILLTOTEST_onOPEN
>                 
>                 if type('form.my_pat_no') #'U'
>                         your code to go to desired record or append
>                 endif
>         return
>
> This MAY help in avoiding implicit movement as the form is already open
> and only your code will cause movement.
> Give this a try.
>
> Regards
> Akshat

I’ve seen the code as you have shown above (type(form.my_pat_no) # ‘U’
But please describe what that line is supposed to accomplish.  In following lines of as yet unwritten code, if findkey(cpat_no) is true, go to edit bill_to information. If findkey(cpat_no) is false, go to beginappend().
What you have done here also is to move the findkey() out of the editpatienttest.women into the onOpen of the bill_to.wfm. I’ll give it a try.
Thanks Akshat
Peter