1

Topic: Problems from the menu on a network

Users work with the program far off on a network. A problem that at start of a network EXE file, there is a form from the menu which does not work (at induction of the cursor of the mouse on menu item it becomes dark blue, and at the subsequent pushing of the mouse - white and it is not uncovered, only on double a clique and that not always). The Same EXE file normally fulfills by the local machine (menu items open on single a clique without problems). In what there can be a problem?

2

Re: Problems from the menu on a network

A little got to the bottom of a problem essence, but yet up to the end:
In one of menu items in the field SkipFor at me stood  isEnable () , with the code that that of type:

select a.* from table where a condition
if _tally = 0
return.T.
else
return.F.
endif

Problem causes select , but yet did not understand why.

3

Re: Problems from the menu on a network

faustgreen wrote:

got to the bottom of a problem essence, but yet up to the end a little:
In one of menu items in the field SkipFor at me stood  isEnable () , with the code that that of type:

select a.* from table where a condition
if _tally = 0
return.T.
else
return.F.
endif

Problem causes select , but yet did not understand why.

Because this operation can be machine strongly depending on resources and a network in which it is not known that is created. As the resulted code is far from an optimality from the point of view of productivity and usage of resources. For now this request is fulfilled all your attempts to push the button and will stick with a mouse to produce the described effects.
As the request is necessary only for presence determination at least to one record in basis it is possible to use top 1 in request not to produce probably big resultant cursor. And all fields in it are not necessary. And which, in turn, to replace with an array disappearing and releasing resources at once at an output from function.

select top 1.t. from table where a condition into array ResArray

5 (Five) remained lines easily also are easy replaced in 1 (One) line

return _tally = 0

4

Re: Problems from the menu on a network

About the last five lines logically, simply got used so handling to do - was received by the cursor if records are one unit of the code if is not present - another. At me it is a construction on the automatic machine it is typed).
On the essence of the task - there is a variable which at presence () should allow to select menu item from some sampling or not. As a variant it is possible to carry out this code there where this variable and there changes, for example, to appropriate result of other variable, and already on it to lock/deblock menu item. So procedure will not be caused in us at each pushing the menu.
Here still the question arose about

top n

records. How it works? Like write that if the table is not sorted and has no index at sampling ALL records at first will be received and only will then be selected N the first.

5

Re: Problems from the menu on a network

faustgreen wrote:

Here still the question arose about

top n

records. How it works? Like write that if the table is not sorted and has no index at sampling ALL records at first will be received and only will then be selected N the first.

This the statement easily also is quickly checked practically. It would not be desirable if to think.

6

Re: Problems from the menu on a network

On the last question - Top N will not work without section order by so here questions disappeared. But the more you dig, the more questions appears.

The table tab1 (id (10), string a C (250)), a record count 1 000 000.

USE tab1 IN 0
timer1_1 = DATETIME ()
SELECT TOP 1 id, string FROM tab1 INTO TABLE t1 ORDER BY id
timer1_2 = DATETIME ()
MESSAGEBOX (timer1_2 - timer1_1)
timer2_1 = DATETIME ()
SELECT id, string FROM tab1 INTO TABLE t2 ORDER BY id
timer2_2 = DATETIME ()
MESSAGEBOX (timer2_2 - timer2_1)
CLOSE TABLES

Results of performance (before spoiler discovery try to foresee result):
[spoiler] MESSAGEBOX (timer1_2 - timer1_1) - 4 seconds
MESSAGEBOX (timer2_2 - timer2_1) - 2 seconds
After  the code (Changed in places both ):

USE tab1 IN 0
timer2_1 = DATETIME ()
SELECT id, string FROM tab1 INTO TABLE t2 ORDER BY id
timer2_2 = DATETIME ()
MESSAGEBOX (timer2_2 - timer2_1)
timer1_1 = DATETIME ()
SELECT TOP 1 id, string FROM tab1 INTO TABLE t1 ORDER BY id
timer1_2 = DATETIME ()
MESSAGEBOX (timer1_2 - timer1_1)
CLOSE TABLES

MESSAGEBOX (timer2_2 - timer2_1) - 3 seconds
MESSAGEBOX (timer1_2 - timer1_1) - 1 seconds
After code change (changed a sort field in the second ):

USE tab1 IN 0
timer1_1 = DATETIME ()
SELECT TOP 1 id, string FROM tab1 INTO TABLE t1 ORDER BY id
timer1_2 = DATETIME ()
MESSAGEBOX (timer1_2 - timer1_1)
timer2_1 = DATETIME ()
SELECT id, string FROM tab1 INTO TABLE t2 ORDER BY string
timer2_2 = DATETIME ()
MESSAGEBOX (timer2_2 - timer2_1)
CLOSE TABLES

MESSAGEBOX (timer1_2 - timer1_1) - 1 seconds
MESSAGEBOX (timer2_2 - timer2_1) - 15 seconds
[/spoiler]
As a whole the subject can be closed, the last message resulted for the sake of interest.