Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A timing thing...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00676739
Message ID:
00676741
Vues:
13
I'm sure there is probably a better way, but I did the same sort of thing with a workorder program. The tech department pulls in work order requests that are keyed into a separate 'requests' table (or pending table) using a timer on the main apps toolbar. When the timer runs, it checks for new records and notifies the user (I allowed the clerk to select visual notification, vocal notification, email, etc) that there are new requests to process. I did not allow the users to key directly into a workorder table because many work order requests are invalid requests so each one had to be verified by a workorder clerk and processed. I also posted the number of pending requests as the caption on a button on the main apps toolbar. The workorder clerk clicked on the button to process the requests. The same thing could be done for your system except without the user intervention I suppose. You can put anything you like in the timer's event.

Here is some simple code in the timer event (before I added other options for notification like email, etc which makes the code more convoluted and this is easier to read):
*!*	LOCAL loForm
*!*	loForm = _screen.activeform.value
*!*	IF !VARTYPE(loForm) = T_OBJECT
*!*		RETURN .T.
*!*	ENDIF
*!*	The interval property specifies the number of milliseconds between Timer events. 
*!*	The default value is 0, which prevents the Timer event from firing.
*!*	The interval is set to 180000 which is every 3 minutes (1000*60*3=180000)
LOCAL llAllow
llAllow = FormIsObject() AND IsA(_Screen.ActiveForm, "cPresentObjForm")
IF !llAllow
	RETURN .T.
ENDIF
IF TYPE("_SCREEN.ActiveForm.Name") <> "C"
	RETURN .T.
ENDIF

LOCAL ;
	lnSelect, ;
	llFound, ;
	lnCount

lnSelect = SELECT()
lnCount=0
llFound=.F.

IF NOT USED("WkRequests")
	USE WkRequests IN 0
ENDIF
IF USED("WkRequests")
	SELECT WkRequests
	llFound = .F.
	GO TOP
	LOCATE FOR !WkRequests.laccept .AND. !WkRequests.lreject
	IF FOUND()
		llFound=.T.
		count to lncount for !WkRequests.laccept .AND. !WkRequests.lreject
	ENDIF

	IF llFound
		This.parent.cmdRequests.caption=ALLTRIM(STR(lncount,4,0))+" Requests! "
		This.parent.cmdRequests.ForeColor=RGB(255,0,0)
		This.parent.cmdRequests.FontBold=.T.
		SET BELL TO '\WORK\TECHSVCS\MISC\REVIEW.WAV'
		?? CHR(7)
		SET BELL TO
	ELSE
		This.parent.cmdRequests.caption="NO Requests Pending"
		This.parent.cmdRequests.ForeColor=RGB(0,0,0)  
		This.parent.cmdRequests.FontBold=.F.
		SET BELL TO
	ENDIF
	This.parent.cmdRequests.Refresh()
	SELECT (lnSelect)
ENDIF
RETURN .T.
>I have a table that is going to act as a stagging area between a SQL Server and my VFP app. SQL will deposite new records (Orders, Order Items and Location information) into my wbOBSin.dbf table. My VFP app needs to bring this information into my app (updating the Orders.dbf, OrderItems.dbf and Locations.dbf) for the users to process. I've already got this working manually via an "Import Next Item" command button on an Import form.
>
>How can I automate this process so that my app will do this without the user?
>
>TIA,
>Rick
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform