SELECT * FROM Premnotes ORDER BY Notenumber DESC Repeat1_NumRows = 10; RsPremnotes_NumRows = RsPremnotes_NumRows + Repeat1_NumRows; // *** Recordset Stats, Move To Record, and Go To Record: set stats variables // set the record count RsPremnotes_total = RsPremnotes.RecordCount; // set the number of rows displayed on this page If (RsPremnotes_NumRows LT 0 OR RsPremnotes_NumRows GTE RsPremnotes_total) { RsPremnotes_NumRows = RsPremnotes_total; } Else If (RsPremnotes_NumRows EQ 0) { RsPremnotes_NumRows = 1; } // set the first and last displayed record RsPremnotes_first = Min(1, RsPremnotes_total); RsPremnotes_last = Min(RsPremnotes_NumRows, RsPremnotes_total); MM_paramName = ""; // *** Move To Record and Go To Record: declare variables MM_rs = RsPremnotes; MM_rsCount = RsPremnotes_total; MM_size = RsPremnotes_NumRows; MM_uniqueCol = ""; MM_paramName = ""; MM_offset = 1; MM_atTotal = false; MM_paramIsDefined = false; If (MM_paramName NEQ "") MM_paramIsDefined = IsDefined(MM_paramName); // *** Move To Record: handle 'index' or 'offset' parameter If (NOT MM_paramIsDefined AND MM_rsCount NEQ 0) { // use index parameter if defined, otherwise use offset parameter If (IsDefined("index")) { MM_offset = index; } Else If (IsDefined("offset")) { MM_offset = offset; } // check if we are past the end of the recordset If (MM_offset GT MM_rsCount OR MM_offset EQ 0) { // past end or move last If ((MM_rsCount MOD MM_size) NEQ 0) { // last page not a full repeat region MM_offset = MM_rsCount - (MM_rsCount MOD MM_size) + 1; } Else { MM_offset = MM_rsCount - MM_size + 1; } } } // *** Move To Record: replace the current query, for navigation on a detail page If (MM_size EQ 1) { // if no repeated regions are defined // create a new query with one row MM_newQuery = QueryNew(MM_rs.ColumnList); QueryAddRow(MM_newQuery, 1); // copy the data in the row pointed to by MM_offset to the new query MM_columns = ListToArray(MM_rs.ColumnList,","); For (i=1; i LTE ArrayLen(MM_columns); i=i+1) { QuerySetCell(MM_newQuery, MM_columns[i], MM_rs[MM_columns[i]][MM_offset], 1); } // change the recordset to be only this one row RsPremnotes = MM_newQuery; } // *** Move To Record: update recordset stats // set the first and last displayed record RsPremnotes_first = Min(MM_offset, MM_rsCount); RsPremnotes_last = Min(MM_offset + MM_size - 1, MM_rsCount); // set the starting index for repeated regions on this recordset RsPremnotes_Index = MM_offset; // set the boolean used by hide region to check if we are on the last record MM_atTotal = (MM_offset + MM_size - 1 GTE MM_rsCount); // *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters // create the list of parameters which should not be maintained MM_removeList = "&index="; If (MM_paramName NEQ "") MM_removeList = MM_removeList & "&" & MM_paramName & "="; MM_keepURL=""; MM_keepForm=""; MM_keepBoth=""; MM_keepNone=""; // add the existing URL parameters to the MM_keepURL string MM_params=ListToArray(CGI.QUERY_STRING,"&"); For (i=1; i LTE ArrayLen(MM_params); i=i+1) { If (FindNoCase("&" & GetToken(MM_params[i],1,"=") & "=",MM_removeList) Is 0) MM_keepURL = MM_keepURL & "&" & MM_params[i]; } // add the existing Form variables to the MM_keepForm string If (IsDefined("FORM.FieldNames")) { MM_params=ListToArray(FORM.FieldNames,","); For (i=1; i LTE ArrayLen(MM_params); i=i+1) { If (FindNoCase("&" & MM_params[i] & "=",MM_removeList) Is 0) MM_keepForm = MM_keepForm & "&" & LCase(MM_params[i]) & "=" & URLEncodedFormat(Evaluate("FORM." & MM_params[i])); } } // create the Form + URL string and remove the intial '&' from each of the strings MM_keepBoth = MM_keepURL & MM_keepForm; If (MM_keepURL NEQ "") MM_keepURL = RemoveChars(MM_keepURL,1,1); If (MM_keepForm NEQ "") MM_keepForm = RemoveChars(MM_keepForm,1,1); If (MM_keepBoth NEQ "") MM_keepBoth = RemoveChars(MM_keepBoth,1,1); // *** Move To Record: set the strings for the first, last, next, and previous links MM_keepMove = MM_keepBoth; MM_moveParam = "index"; // if the page has a repeated region, remove 'offset' from the maintained parameters if (MM_size GT 1) { MM_moveParam = "offset"; MM_params = ListToArray(MM_keepMove,"&"); MM_keepMove = ""; For (i=1; i LTE ArrayLen(MM_params); i=i+1) { If (CompareNoCase(GetToken(MM_params[i],1,"="),MM_moveParam) IS NOT 0) { MM_keepMove = MM_keepMove & "&" & MM_params[i]; } } If (MM_keepMove NEQ "") { MM_keepMove = RemoveChars(MM_keepMove,1,1); } } // set the strings for the move to links if (MM_keepMove NEQ "") MM_keepMove = MM_keepMove & "&"; urlStr = CGI.SCRIPT_NAME & "?" & MM_keepMove & MM_moveParam & "="; MM_moveFirst = urlStr & "1"; MM_moveLast = urlStr & "0"; MM_moveNext = urlStr & (MM_offset + MM_size); MM_movePrev = urlStr & Max(MM_offset-MM_size,1); PREM Advisory Service
Logo The World Bank Group Contact Us • Help/FAQ • Index • Search  
 
 
 
View PREMNotes on:
Economic Policy
Gender
Governance & Public Sector Reform
Poverty
Search PREM Notes
PREM Advisory Service
 

PREM Advisory Service

What we do...

Provide assistance in finding World Bank information as well as resources available from our partners related to Governance and Public Sector Reform, Gender, Economic Management, and Poverty issues - including the Poverty Reduction Strategy and Heavily Indebted Poor Countries (HIPC) initiatives.

We'll help you locate working papers, best practices, key policies, contacts, project information and useful links on World Bank websites.

How to contact us...

Tel: (202) 458-7736

Fax: (202) 522-1135

E-mail: premadvisory@worldbank.org



 
 
Globe logo Contact Us | Help/FAQ Site Index | Search Home