main logo
Subject: Re: Record Navigation with Remote Views
Author: Mike Devlin
Posted: 2002/11/07 16:02:04
 
View Entire Thread
New Search


Hey BOb,
So, I created a new behavior object with new navigation methods. These methods make use of the ROWNUM pseudocolumn in Oracle and ordered views in Oracle to move from record to record, and alos as a means for developing a find form for all of my forms. I had to create a find table and view that would allow me to scroll through and search the view in various orders. It basically does calls such as the following:
LOCAL lcLocalViewName, lcSQL, lnRetVal

lnRetVal = FILE_OK

IF This.EOF()
*-----------------------
*-- Return the EOF code.
*-----------------------
lnRetVal = FILE_EOF
ELSE

*---------------------------
*-- Move to the next record.
*---------------------------
IF goApp.lUseLocalData
lcLocalViewName = 'lv_' + ALLTRIM(v_find_vp.queryName)
IF !USED(lcLocalViewName)
USE (lcLocalViewName) IN 0
ENDIF

lcSQL = 'SELECT nid, RECNO() AS row_num '+;
'FROM lv_' + ALLTRIM(v_find_vp.queryName) +;
' WHERE row_num = ' + ALLTRIM(STR(_Screen.ActiveForm.nRowNum + 1)) +;
' INTO CURSOR nextNum'

&lcSQL

IF USED(lcLocalViewName)
SELECT (lcLocalViewName)
USE
ENDIF
ELSE
lcSQL = 'SELECT nid, row_num ' +;
'FROM ( ' +;
'SELECT nid, ROWNUM AS row_num '+;
'FROM QRY_' + ALLTRIM(v_find_vp.queryName) +;
') a ' +;
' WHERE row_num = ' + ALLTRIM(STR(_Screen.ActiveForm.nRowNum + 1)) + '; '

lnRetVal = SQLEXEC(goApp.oSecurity.nConnectionHandle, lcSQL, 'nextNum')
ENDIF

_Screen.ActiveForm.oBizObj.cViewParamField2 = nextNum.nid
_Screen.ActiveForm.nRowNum = nextNum.row_num

IF USED('nextNum')
SELECT nextNum
USE
ENDIF

_Screen.ActiveForm.oBizObj.Requery()

*This is basically a RECCOUNT of the ordered view

IF This.EOF()
*--------------------------------------------------
*-- If this moved us to the the last record return the EOF code.
*--------------------------------------------------
lnRetVal = FILE_EOF
ENDIF
ENDIF

RETURN lnRetVal

I had some trouble making it work with both local and remote data, but I just added a property to the application object to control the local or remote data access. I have some new code in the i-layer bizobj form, and the find form is pretty cool as well I must say.

I also made a little function called getcurrownum, which I am calling before any navigation, just to make sure that I am not skipping records due to deletions. Since it constantly queries these views, the data is also always current.

So, one record at a time across the network, and record navigation on the client machines, all one record at a time.

Thanks for all your help with this, you are a lifesaver.

Mike D
Devman
mdevlin At ajdebruin .D.O.T com

 
©2002 Mike Devlin
<-- Prior Message New Search Next Message -->