Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the CursorSource in the DataEnvironment
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00115080
Message ID:
00115250
Views:
12
>>>YOu change the cursor's database property it with form code in the dataenvironment's beforeopentables event.
>>
>>I'm sorry Erik, that was kind of vague. My understanding is that
>>as soon as the cursor object is instatiated, the table is opened.
>>Is this not the case? You said 'database property', am I correct
>>in assuming that you meant the CursorSource, or is there another
>>property which I should be looking at (these are free tables).
>>
>>Thanks for your response.
>>
>
>I guess it was a little vague. And you are correct, the database property is of no consequence to you since you are using free tables.
>
>That the table is opened when the cursor object is instanciated is only partially correct. AS members of the DE, cursor objects are instanciated, but their tables are not opened until after the form.dataenvironment.beforeopentables event. That's why this is the perfect place to put this code (it can also go in DE.init or form.load).
>
>The common way to do this is to check the value of a global variable or an application object's property that tells your DE where your tables are, and then loop through the cursor objects in the DE, changing the cursorsource property accordingly.
>
>Hope I was a little clearer.
--------
I'm still relatively new to VFP so I'm not sure if my 2.6 way of doing this would still be applicable.....
What I've done before is to use macro substiution similar to the following....

SELECT &cFieldList ;
FROM &cSourceTableList ;
INTO CURSOR cYourCursor ;
&cOrderByClause + &cGroupByClause + &cWhereClause

I don't guarantee the syntax, I'm doing this from memory :-)

This style would allow me to re-run the query as often as need be at run-time, with possibly different "user specified parameters" each time.

Would I still do this in VFP or is there a better way?
-------
Previous
Reply
Map
View

Click here to load this message in the networking platform