|
Home > Archive > Programming with dBASE > February 2006 > form's rowset
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Moses Hanna 2006-02-25, 9:36 am |
| Hi,
I have a form with three queries on it. I am not using datamodule.
within the form, I change the form's rowset, many times.
I want to put a code to see which query is current form's active rowset
I coded:
if form.rowset = form.q1.rowset
statements
elseif form.rowset = form.q2.rowset
statements
elseif form.rowset = form.q3.rowset
statements
endif
this code gives me an error
I coded
if form.rowset = "form.q1.rowset"
statements
elseif form.rowset = "form.q2.rowset"
statements
elseif form.rowset = "form.q3.rowset"
statements
endif
it doesn't give an error message but doesn't execute the statements.
Any Help, please
Moses
| |
|
| I am sure there are better ways to do it, but to keep along your thought
process, try
if form.rowset.parent.sql = form.q1.rowset.parent.sql
should work, as long as they all have different sql statements.
Glenn Fausel
> Hi,
> I have a form with three queries on it. I am not using datamodule.
> within the form, I change the form's rowset, many times.
> I want to put a code to see which query is current form's active rowset
> I coded:
> if form.rowset = form.q1.rowset
> statements
> elseif form.rowset = form.q2.rowset
> statements
> elseif form.rowset = form.q3.rowset
> statements
> endif
> this code gives me an error
> I coded
> if form.rowset = "form.q1.rowset"
> statements
> elseif form.rowset = "form.q2.rowset"
> statements
> elseif form.rowset = "form.q3.rowset"
> statements
> endif
> it doesn't give an error message but doesn't execute the statements.
> Any Help, please
> Moses
>
>
| |
| Michael Nuwer [dBVIPS] 2006-02-25, 9:36 am |
| Glenn wrote:
> I am sure there are better ways to do it, but to keep along your thought
> process, try
>
> if form.rowset.parent.sql = form.q1.rowset.parent.sql
I had a similar thought:
form.rowset.tableName = form.q1.rowset.tableName
But, then I tested:
if form.rowset = form.q1.rowset
? "q1"
elseif form.rowset = form.q2.rowset
? "q2"
endif
And it worked just fine.
So..., Moses, what is the error that you are getting?
[color=darkred]
| |
| Moses Hanna 2006-02-25, 9:36 am |
| Hi
The case is not like that. I tried to simplify my question and posted it as
it came. But the case is:
I have two forms. each one of them has different form.rowset.
I am using the copy of the dbase calendar.cc) on both of them.
The first form is appointments management form. it's form.rowset is
form.diary1.rowset
The second form is reminders management form. it's form.rowset is
form.reminders1.rowset
In the function setdate() in the calendar.cc code I want to put some code to
check either which form it is
(If it is appointments form.. it will findkey() in the diary1.rowset and
display appointments of that date, or if it is reminders form, it will a
date efntryfield on that form with the (this.date) ( I want to customise
theis copy of the calendar.cc)
I put Michael's code:
if form.rowset = form.diary1.rowset
if not form.rowset.findkey(this.date)
msgbox("Date not found")
endif
elseif form.rowset = form.reminders1.rowset
form.rcr1.rdateef.value = this.date
endif
It works fine when opening appointments form
but when I open reminders form
it gives an error message (variable undefined diary1)
Thanks
Moses
"Michael Nuwer [dBVIPS]" <nuwermj@yahoo.com> wrote in message
news:sv9LzlaOGHA.560@news-server...[color=darkred]
> Glenn wrote:
>
> I had a similar thought:
> form.rowset.tableName = form.q1.rowset.tableName
>
> But, then I tested:
> if form.rowset = form.q1.rowset
> ? "q1"
> elseif form.rowset = form.q2.rowset
> ? "q2"
> endif
>
> And it worked just fine.
>
> So..., Moses, what is the error that you are getting?
>
| |
| Michael Nuwer [dBVIPS] 2006-02-25, 9:36 am |
| Moses Hanna wrote:
> In the function setdate() in the calendar.cc code I want to put some code to
> check either which form it is
> (If it is appointments form.. it will findkey() in the diary1.rowset and
> display appointments of that date, or if it is reminders form, it will a
> date efntryfield on that form with the (this.date) ( I want to customise
> theis copy of the calendar.cc)
The better way to handle this problem is to add a custom setDate method
to *each* form. In form one, add a method called setDate and enter the
code that is particular for this form. Then in form two add another
setDate method. This one should contain code particular to form two. The
calendar control is designed to call this method (yes the one in the
form) IF it exists. If it does not exit, the control calls its own
internal method. (See the code in the calendar's custom button.)
Here's an example:
** END HEADER -- do not remove this line
//
// Generated on 06/11/2003
//
parameter bModal
local f
f = new CalendarForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class CalendarForm of FORM
set procedure to :FormControls:calend
ar.cc additive
with (this)
onOpen = class::FORM_ONOPEN
metric = 6 // Pixels
height = 180
left = 241
top = 0
width = 193
text = ""
autoCenter = true
endwith
this.CALENDAR1 = new CALENDAR(this)
with (this.CALENDAR1)
left = 7
top = 11
width = 176
height = 158
endwith
function form_onOpen
// register form controls with Calendar
this.calendar1. registerOwners(form)
return
function setDate(dDate)
// set defaults for missing params
dDate = iif(empty(dDate),dat
e(),dDate)
this.date = dDate // Selected date
? "You clicked "+dDate
//this.close()
return
endclass
| |
| Moses Hanna 2006-02-28, 8:25 pm |
| Michael
I have put this function code in a form that contains a date entryfield. It
worked fine
function setDate(dDate)
// set defaults for missing params
dDate = iif(empty(dDate),dat
e(),dDate)
this.date = dDate // Selected date
form.rcr1.rdateef.value = ddate
return
I put the following function code on a form with diary1 rowset and want to
take rowpinter to the selected date:
function setDate(dDate)
// set defaults for missing params
dDate = iif(empty(dDate),dat
e(),dDate)
this.date = dDate // Selected date
form.diary1.rowset.indexname = "adate" //// date index
form.diary1.rowset.filndkey(ddate)
return
but it gives me an error message ... data type mismatch, expecting date
I put
form.diary1.rowset. filndkey(ctod(ddate)
)
but it gives me an error message ... data type mismatch, expecting character
what is wrong with my code
Moses
"Michael Nuwer [dBVIPS]" <nuwermj@yahoo.com> wrote in message
news:eJ3lhKgOGHA.592@news-server...
> The better way to handle this problem is to add a custom setDate method to
> *each* form. In form one, add a method called setDate and enter the code
> that is particular for this form. Then in form two add another setDate
> method. This one should contain code particular to form two. The calendar
> control is designed to call this method (yes the one in the form) IF it
> exists. If it does not exit, the control calls its own internal method.
> (See the code in the calendar's custom button.)
>
> Here's an example:
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 06/11/2003
> //
> parameter bModal
> local f
> f = new CalendarForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class CalendarForm of FORM
> set procedure to :FormControls:calend
ar.cc additive
> with (this)
> onOpen = class::FORM_ONOPEN
> metric = 6 // Pixels
> height = 180
> left = 241
> top = 0
> width = 193
> text = ""
> autoCenter = true
> endwith
>
> this.CALENDAR1 = new CALENDAR(this)
> with (this.CALENDAR1)
> left = 7
> top = 11
> width = 176
> height = 158
> endwith
>
> function form_onOpen
> // register form controls with Calendar
> this.calendar1. registerOwners(form)
> return
>
> function setDate(dDate)
> // set defaults for missing params
> dDate = iif(empty(dDate),dat
e(),dDate)
> this.date = dDate // Selected date
> ? "You clicked "+dDate
> //this.close()
> return
> endclass
>
| |
| Michael Nuwer [dBVIPS] 2006-02-28, 8:25 pm |
| Moses Hanna wrote:
> form.diary1.rowset.indexname = "adate" //// date index
> form.diary1.rowset.filndkey(ddate)
> return
> but it gives me an error message ... data type mismatch, expecting date
> I put
> form.diary1.rowset. filndkey(ctod(ddate)
)
> but it gives me an error message ... data type mismatch, expecting character
> what is wrong with my code
>
"dDate" is a date object (not a variable of type date) and, if I recall
correctly, there is bug in the date object.
Does the following line work for you?
form.diary1.rowset. findkey(ctod(dtoc(dD
ate)))
| |
| Moses Hanna 2006-02-28, 8:25 pm |
| Yes, it is working now
Michael, You are a genius
Thanks
Moses
"Michael Nuwer [dBVIPS]" <nuwermj@no.spam.yahoo.com> wrote in message
news:5cMyhW6OGHA.2016@news-server...
> Moses Hanna wrote:
>
>
> "dDate" is a date object (not a variable of type date) and, if I recall
> correctly, there is bug in the date object.
>
> Does the following line work for you?
>
> form.diary1.rowset. findkey(ctod(dtoc(dD
ate)))
>
>
|
|
|
|
|