Parameter pActivePath, pDBCName
*-- Declarations
LOCAL lnCursorIndex && Index pointer to next item to add to cursor list
LOCAL lcMemberList[1] && Temporary array of all members in the data environment
LOCAL lnCnt && Loop counter
LOCAL lcExec && Command to execute
local lcCursor
local lcDBCName && The DBC name
local llDoit
local lcActivePath
*---
lcActivePath = addbs(pActivePath) && Make sure there is a \ on base path
*
* Addition Parameters?
*
if pCount() = 1
pDBCName = ""
endif
pDBCName = JUSTFNAME(allt(upper(pDBCName)))
IF EMPTY(JUSTEXT(pDBCName))
pDBCName = pDBCNAME+".DBC"
ENDIF
*!* *-- Initialization
lnCursorIndex = 1
*-- Build an internal list of all cursors, aliases, and databases in the
*-- current data session's data environment
=AMEMBERS(lcMemberList, THISFORM.DataEnvironment, 2)
*
IF TYPE("lcMemberList[1]") == "C"
*
* Find all "cursor" objects
*
FOR lnCnt = 1 TO ALEN(lcMemberList, 1)
lcCursor = "THISFORM.DataEnvironment." + lcMemberList[lnCnt]
IF &lcCursor..BaseClass == "Cursor"
*
* What is the name of the DBC this Cursor belongs to?
*
lcDBCName = JustFNAME(allt(upper(&lcCursor..Database)))
*
* Do I Need to change this cursor's path?
*
llDoit = iif(empty( pDBCName), .t., (lcDBCName = pDBCName))
if llDoit
*
* Yep, change it ...
*
lcExec = "THISFORM.DataEnvironment." + ;
lcMemberList[lnCnt] + ;
".Database = '" + lcActivePath + lcDBCName + "'"
&lcExec
endif
endif
NEXT
ENDIF