Re: dataenvironment class code by Dave
Dave
Mon Apr 03 18:53:20 CDT 2006
Thanks, I tried using the object name also (just really trying
anything) but no luck. Your first suggesting is working just fine, and
seems to be quit fast.
Dave
On Sat, 01 Apr 2006 10:49:24 -0800, Jack Jackson
<jacknospam@pebbleridge.com> wrote:
>You can't use "this". The filter expression gets evaluated every time
>the record pointer of the table changes, and whatever you have in the
>filter expression must be able to be evaluated when that happens.
>
>"this" refers to the current object, which will not be your class.
>
>"thisform" may work, but I'm not sure exactly what environment the
>filter expression gets evaluated in.
>
>On Sat, 01 Apr 2006 09:17:48 -0500, Dave <scialabba2@comcast.net>
>wrote:
>
>>Dan, I actually tried using properties but I couldn't get the filter
>>expression to work This is what I used.
>>
>>this.cursor1.filter = "BETWEEN(dinspectionact, this.dStartDate,
>>this.dEndDate)
>>
>>The properties did contain valid dates so it makes me think the filter
>>expression was wrong.
>>
>>Right now I'm using Jack's solution (thank-you), but I think using
>>properties would be the way to go.
>>
>>
>>Dave
>>
>>
>>
>>On Fri, 31 Mar 2006 08:37:57 -0800, "Dan Freeman" <spam@microsoft.com>
>>wrote:
>>
>>>Probably doesn't exactly work if they're PUBLIC. Just doesn't error because
>>>they're in scope.
>>>
>>>You're declaring those variables LOCAL to the init, which means those values
>>>are local copies that disappear when the init method ends.
>>>
>>>If you're going to use values that are scoped to the life of the form, they
>>>should be Form properties. (Form menu -> New Property)
>>>
>>>Dan
>>>
>>>Dave wrote:
>>>> Hello All,
>>>>
>>>> I have the following code for an dataenvironment for a report.
>>>> The last line("this.cursor1.filter...) in the IF statement doesn't
>>>> work unless I have the variables as PUBLIC. The variables contain
>>>> valid dates. Could I do this any other way?
>>>>
>>>> Thanks
>>>> Dave
>>>>
>>>> DEFINE CLASS dteInspectionHoursReport as dteDataEnvironment
>>>>
>>>> initialselectedalias = "vr0002"
>>>>
>>>> ADD OBJECT cursor1 as cursor WITH ;
>>>> alias = "vr0002", ;
>>>> cursorsource = "vr0002", ;
>>>> database = "main.dbc"
>>>>
>>>> PROCEDURE Init()
>>>> DODEFAULT()
>>>> LOCAL loDateRange as Object, ldStartDate as Date, ;
>>>> ldEndDate as Date
>>>> LOCAL ARRAY laDate[2]
>>>>
>>>> laDate[1] = DATE() - 30
>>>> laDate[2] = DATE()
>>>>
>>>> loDateRange = CREATEOBJECT("_daterange",@laDate)
>>>> loDateRange.Show(1)
>>>>
>>>> IF TYPE("loDateRange") = "O" AND !ISNULL(loDateRange)
>>>> ldStartDate = loDateRange.dStartDate
>>>> ldEndDate = loDateRange.dEndDate
>>>>
>>>> this.cursor1.filter =
>>>> "BETWEEN(dinspectionact,ldStartDate,ldEndDate)"
>>>> ENDIF
>>>>
>>>> ENDPROC
>>>>
>>>> ENDDEFINE
>>>