Subject |
Re: Form to Form |
From |
Peter <phb2020@hotnail.com> |
Date |
Fri, 12 May 2023 15:27:00 -0400 |
Newsgroups |
dbase.getting-started |
Peter wrote:
I am away without my computer ( a treat to myself).so I can’t test anything.
Some clarification for some your questions:
The pat_no field is 5 numbers. That is the field that is ultimately responsible as unique to select any choice, not last _name+first_name, although there is an index of patienttest.dbf that is upper(last_name+first_name) with spaces and trims as has been described many times, appropriately, in your books.
Even if user enters last_name into entryfield1 to determine order of grid, I have always wanted to use pat_no as unique field to define how later seeks are used. User has choice of entry as either last_name or pat_no, onLostFocus of entryfield1, index is selected for order in grid. After pushbutton_goto is clicked, I planned to use pat_no as the way to proceed to second form in order to edit.
Maybe a bit wordy, but there you have it.
I’m a bit surprised that there isn’t a best way to get pat_no from firm1 to form2. These 2 forms use the same dbf.
Peter
Mervyn Bick Wrote:
> On 2023/05/11 13:02, Mervyn Bick wrote:
>
> > Â function PBGOTO_OnClick()
> > Â Â Â //Save the pat_no value to a user-defined property of editpastest
> > Â Â Â //in memory
> > Â Â Â form.edit_pat_test.Goto = class::get_pat_no() //Discussed later.
> > Â Â Â if form.edit_pat_test.goto <> null
> > Â Â Â Â Â //Set the rowset pointer in editpastest
> > Â Â Â Â Â //I assume the query name in editpattest is also patient1. If not,
> > Â Â Â Â Â //use the correct query name.
> > Â Â Â Â Â form.edit_pat_test.patient1.rowset.goto(form.edit_pat_test.goto)
> > Â Â Â Â Â form.edit_pat_test.open()
> > Â Â Â else
> > Â Â Â Â Â msgbox('Invalid patient number or name')
> > Â Â Â endif
> > Â Â Â return
> >
> >
> > Â function get_pat_no()
> > Â Â Â //As the user can enter either the patient number or the patient
> > Â Â Â //name you need some mechanism for making sure the user enters a
> > Â Â Â //valid value.
> > Â Â Â local nRet
> > Â Â Â nRet = null // If a record is found this will be overwritten
> >
> > Â Â Â // Code needed here to verify selection.
> >
> > Â Â Â return nRet
>
> After a bit more thought, getting the pat_no required is better done
> before the user clicks on the GOTO pushbuton.
>
>
> function PBGOTO_OnClick()
> //The pat_no value has been saved to a user-defined property
> //of editpastest form.edit_pat_test.goto in memory
> //Set the rowset pointer in editpattest
> //I assume the query name in editpattest is also patient1. If not,
> //use the correct query name.
> form.edit_pat_test.patient1.rowset.goto(form.edit_pat_test.goto)
> form.edit_pat_test.open()
> return
>
> As the user moves through the patient file use the rowset's onNavigate
> event handler to save the pat_no to form.edit_pat_test.goto ready for
> the user to click the GOTO button. The user can use the up and down
> arrow keys to move through the patient table displayed in a grid in
> which case a new pat_no will be saved each time a new record is
> selected. If the user uses the mouse wheel to scroll the grid it will
> be necessary to click on a record to save the pat_no.
>
> function rowset_onNavigate(type, nRows)
> local cPatient,f
> form.edit_pat_test.goto = this.fields['pat_no'].value
> //Display the selected patient's name in a separate entryfield
> //Don't overwrite the entryfield used for keyboard selection
> f = form.patient1.rowset.fields //To save typing later
> cPatient = f['pat_no'].value + ' --- '
> cPatient += trim(f['lname'].value) + ', '
> cpatient += trim(f['fname'].value)
> form.entryfield2.value = cPatient
> return
>
> To make sure form.edit_pat_test.goto has the value of the first patent
> when the form opens use the query's onOpen event handler. If you don't
> do this clicking the GOTO button to open the edit form for the first
> patient will give an error.
>
> function PATIENT1_onOpen()
> form.edit_pat_test.goto = this.rowset.fields['pat_no'].value
> return
>
> You are going to have to decide whether you want to open the the main
> form with the patients displayed in patient order or name order.
> Probably the name order would be the better choice.
>
> To allow the user to type either a pat_no or a last name into
> entryfield1 may mean some fancy footwork in entryfield1's onKey event
> handler. Is your pat_no field numeric(5,0) or is it char(5)?
>
> We're heading into another 4hour power outage shortly so that's it for now.
>
> Mervyn.
>
>
>
>
>
>
>
>
>
>
>
|
|