Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EXCLUSIVE and USED()
Message
From
02/09/2008 15:59:24
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344237
Message ID:
01344283
Views:
13
>Jay,
>
>Take a look at "CREATE VIEW Command", it might help you as you can create the view, close all the tables, do your stuff and then restore all the tables to what they were

Ok, don't laugh, but I couldn't think of a better way than the code below, though I'm sure there must be. The problem is that the program that this is running in is VERY touchy with workareas, etc. It's old code, but it's what we have to use. Let me know if there is anything obvious that I could do.
			************************************************************************
			* JJ - Eligibility Project
			* Put code to delete/pack WorkList and WorkList_Detail tables here?
			************************************************************************
			SELECT ss.SysValue FROM SystemSetup ss WHERE ss.SysType = 'ELIGIBILITY' AND ss.SysKey = 'DELPACK' INTO CURSOR EligibilitySetup
			m.DelPackDays = VAL(ALLTRIM(EligibilitySetup.SysValue))
			USE IN EligibilitySetup

			m.WorkListUsed = .F.
			m.WorkListExcl = .F.
			m.WorkListDetUsed = .F.
			m.WorkListDetExcl = .F.

			IF !USED('WorkList')
				m.WorkListUsed = .F.
				USE (m_prom_dir) + 'WORKLIST' EXCLUSIVE IN 0
			ELSE
				m.WorkListUsed = .T.
				IF ISEXCLUSIVE('WorkList')
					m.WorkListExcl = .T.
				ELSE
					m.WorkListExcl = .F.
					USE IN (SELECT('WorkList'))
					USE (m_prom_dir) + 'WORKLIST' EXCLUSIVE IN 0
				ENDIF
			ENDIF

			IF !USED('WorkList_Detail')
				m.WorkListDetUsed = .F.
				USE (m_prom_dir) + 'WORKLIST_DETAIL' EXCLUSIVE IN 0
			ELSE
				m.WorkListDetUsed = .T.
				IF ISEXCLUSIVE('WorkList_Detail')
					m.WorkListDetExcl = .T.
				ELSE
					m.WorkListDetExcl = .F.
					USE IN (SELECT('WorkList_Detail'))
					USE (m_prom_dir) + 'WORKLIST_DETAIL' EXCLUSIVE IN 0
				ENDIF
			ENDIF

			SELECT WorkList
			SCAN FOR (WorkList.TransDt < (DATETIME() -(m.DelPackDays * (24*60*60)))) AND WorkList.Archive = .T.
				SELECT WorkList_Detail
				DELETE FOR WorkList_Detail.TransID = WorkList.TransID
				SELECT WorkList
				DELETE
			ENDSCAN

			SELECT WorkList_Detail
			PACK

			IF m.WorkListDetUsed = .T.
				IF m.WorkListDetExcl = .F.
					USE IN (SELECT('WorkList_Detail'))
					USE WorkList_Detail IN 0 SHARED
				ENDIF
			ENDIF

			SELECT WorkList
			PACK

			IF m.WorkListUsed = .T.
				IF m.WorkListExcl = .F.
					USE IN (SELECT('WorkList'))
					USE WorkList IN 0 SHARED
				ENDIF
			ENDIF
			************************************************************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform