Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why the difference?
Message
 
 
To
26/06/2001 15:47:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00523778
Message ID:
00523825
Views:
18
Then you need to create 1 parameterized view:

Create Sql View v_contracts as select * from ctracts where somefield = ?cSomeValue order by fieldx

Then when the filter criteria changes:

local cSomeValue
cSomeValue = "X"
requery('v_contracts')

When you first open the view, do so with the nodata option:

use v_Contracts nodata

Or, if you put the view in the DE of the form, set the NoDataOnLoad property to True.


>I take your point. The specs call for constant filtering. When the app starts up, the data must be filtered, and the user can change the filter on demand. There is only one dbc shared on the network. Rather than setting filters, I thought I'd try recreating the view's select statement according the the filtering information. Doing it that way requires recreating it on each filter request. There are also a couple of other related views that are requeried depending on the information int the main view, but they are not recreated each time. This may well be the wrong way to go about it, but I figured it would be a worthwhile experiment.
>
>I'll probably go back and do it by setting filters on the view rather than this way, but for the moment, it still doesn't answer my question about why the same code in the exe takes 8.5 seconds longer than doing it from the command window.
>
>As a matter of fact, if I create the view and add it to the database, then let the datasession open it nodataonload, the requery after creating view indices still takes over 8 seconds to pull the data down. So either way, it causes the exe to start up extremely slowly for no good reason that I can see.
>
>Alan
>
>>I do not understand why you would need to create this view every time you start the app. Are you creating a user DBC on the local drive for all our views? And using a shared DBC on the server? Once you create the view, you should not need to recreate every time, and you would then eliminate any need to bpack the DBC. IMHO, this is all bad practice to do under runtime.
>>
>>>I finally give up. I have an application that, when it starts up, creates an sql view, and it opens the view reeeeaaal slow.
>>>
>>>It's a simple view - "Create Sql View v_contracts as select * from ctracts". I don't see how it could be any simpler. The data lives on the network. Also I should mention that I pack the database before exiting the application, so that when it starts up again, there are no deleted records in the database itself.
>>>
>>>If, from the command window, I type,
>>>
>>>
>>>Set safety off
>>>open database contracts
>>>set database to contracts
>>>create sql view v_contracts as select * from ctracts
>>>set safety on
>>>use v_contracts nodata
>>>requery('v_contracts')
>>>
>>>
>>>that last requery line pulls down the 10,000 records in .44 seconds.
>>>
>>>Now, if I create a completely empty form, and put those very same lines in the beforeopentables() event of the datasession, compile it into an exe and run it, that last requery line pulls the same 10,000 records down in 8.99 seconds.
>>>
>>>The code in the actual application has more to it, but for the purpose of testing, I did the above and kept it as simple as I could.
>>>
>>>Can anybody give me a clue what I should be looking for as to why an exe might take so much longer than the command window to get the same records from the same table on the same network using the same code?
>>>
>>>Alan
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform