Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form intermittent slowness
Message
From
14/11/2022 10:12:25
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Form intermittent slowness
Miscellaneous
Thread ID:
01685323
Message ID:
01685323
Views:
77
Got another weird problem, though in a different application than the one I usually ask for. This client has a fairly simple application based on the old MEI framework. Most forms have a two-page pageframe, with the first page holding a grid showing the records in the table and a textbox above for incremental search to find the desired record. (There's a little more, but not relevant to this problem.)

In one form only, sometimes the users are encountering delays in the search as well as in arrowing through the grid. In the search textbox, the problem manifests as typing a letter (sometimes the first, but sometimes a later letter) and having a noticeable delay before the grid catches up. It's not on particular values and it can happen for a value once and then not again for that value.

It seems to happen more when there's more than one user in the form, but they tell me they've seen it with only a single user and it doesn't always happen with more than one. I can't replicate here, even when opening the application twice.

They reindex daily using DELETE TAG ALL and INDEX commands, so I don't think this is index trouble. I've checked the table for bad data in the relevant field (the one they search on most) and while I found one record with a low-ASCII character there, I fixed that and the problem persists.

There's not much code here. This is the code in the textbox's InteractiveChange method:
 LOCAL nselect
 nselect = SELECT()
 SELECT prodlist
 IF this.parent.chkexact.value=1
    SET NEAR ON
    SEEK ALLTRIM(this.value) 
 ELSE
    IF this.parent.cbosearch.value='CODE'
       LOCATE FOR ALLTRIM(this.value)$prodcode
    ELSE
       LOCATE FOR ALLTRIM(this.value)$UPPER(prodesrp)
    ENDIF
 ENDIF
 this.parent.grdproduct.setfocus()
 this.setfocus()
 SET NEAR OFF
 SELECT (nselect)
and the only code in the grid itself or its contents is this in AfterRowColChange:
LPARAMETERS nColIndex

ThisForm.AllowDelete()
I'm actually inclined to think the issue is related to the AfterRowColChange code because I added that fairly recently and the problem is new and also because it happens on arrowing, not just on searches. Here's the code in AllowDelete:
* Modified 25-May-2022 by TEG
* If this product is in use, disable the Delete button
LOCAL iKey, lAllowDelete

iKey = ProdList.Key
lAllowDelete = .T.

SELECT ProdKey ;
	FROM Detail ;
	WHERE ProdKey = m.iKey ;
	INTO CURSOR csrMatches
	
IF _TALLY > 0
	lAllowDelete = .F.
ENDIF

IF m.lAllowDelete
	* Now check Archive
	SELECT ProdKey ;
		FROM Archive ;
		WHERE ProdKey = m.iKey ;
		INTO CURSOR csrMatches
	
	IF _TALLY > 0
		lAllowDelete = .F.
	ENDIF
ENDIF 

ThisForm.Mycommandbutton4.Enabled = m.lAllowDelete

RETURN
As for table sizes, the one they're searching in has about 6000 records. The two queried in AllowDelete have a few hundred (Detail) and around 160,000 (Archive). (I didn't design this system where orders are moved into another set of tables after fulfillment, but it works for them, so I'm not changing it.)

I just experimented to see whether holding any locks in Detail or Archive while moving in the grid causes the problem, but nope.

Any suggestions?

Tamar
Next
Reply
Map
View

Click here to load this message in the networking platform