Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ordering the query-Page result
Message
General information
Forum:
Visual FoxPro
Category:
ActiveVFP
Miscellaneous
Thread ID:
00891921
Message ID:
00891946
Views:
27
William,
Did you take a look at the SessionList method in the demo? That seems to be the same thing you want unless I'm missing something. Use the Session object to save any kind of variable(see code below).
The URL for sorting by Title, for example, is
http://localhost/avfpdemo2/default.aspx?action=sessionlist&order=title
The code in the vfp mtdll is as follows:
FUNCTION sessionlist
LOCAL lcHTMLfile,lcHTMLout,lcOrder,lcKeyWord,lnCount
lcOrder=""
lcKeyWord="'"+UPPER(NVL(oRequest.FORM("keyword"),"")+"'")
lcOrder=oSession.VALUE("thissort")
IF (ISNULL(lcOrder) .OR. EMPTY(lcOrder))
	lcOrder = "2"  && company order
ENDIF
DO CASE
CASE oRequest.querystring("order")=="company"
	lcOrder= "2" && company order
CASE oRequest.querystring("order")=="contact"
	lcOrder = "3" && contact order
CASE oRequest.querystring("order") =="title"
	lcOrder = "title"
ENDCASE
* save sort to session
oSession.VALUE("thissort",lcOrder)
IF EMPTY(lcKeyWord)
	SELE * FROM Customer ORDER BY &lcOrder INTO CURSOR tCursor
ELSE
	SELE * WHERE UPPER(company)=UPPER(&lcKeyWord) FROM Customer ;
		ORDER BY &lcOrder INTO CURSOR tCursor
	IF RECCOUNT()=0
		SELE * WHERE &lcKeyWord $ UPPER(company) FROM Customer ;
			ORDER BY &lcOrder INTO CURSOR tCursor
	ENDIF
ENDIF
lcHTMLfile = 'sessionlist.htm'
lcHTMLout=FILETOSTR(oProp.HtmlPath+lcHTMLfile)
lcHTMLout= oHTML.htmlTable('customers',lcHTMLout,10,.T.,'#E5E5E5',.F.;
	,VAL(oRequest.querystring("page")),oRequest.querystring("nav"))
lcHTMLout= oHTML.mergetext(lcHTMLout)
*
RETURN lcHTMLout
ENDFUNC
>Please helpme.
>
>My problem is the next:
>my main web page have some items(as links) sample:
>
>-apples
>-oranges
>-pineapple
>
>then when the user make click in a item(apples by example)
>the code for the each link is :
>
><%=oProp.ScriptPath +[?action=ChosedItem&item_id=]+'01'
><%=oProp.ScriptPath +[?action=ChosedItem&item_id=]+'02'
><%=oProp.ScriptPath +[?action=ChosedItem&item_id=]+'03'
>
>A query is choosed to show only the records with the item selected. until there
>work fine...
>
>Now i need order the result by someone column(sample : color, price,size),
>i put this code for the "color" column:
><%= oProp.ScriptPath+[?action=]+oProp.Action+[&order=]+'thecolor'
>
>the code for the COM Server is:
>
>FUNCTION ChosedItem
>LOCAL lcHTMLfile,lcHTMLout,lcItemId,lcOrder
> lcItemId=oRequest.querystring("item_id")
> lcOrder=""
>
>IF (ISNULL(lcOrder) .OR. EMPTY(lcOrder))
> lcOrder = [1]
>ENDIF
>DO CASE
> CASE oRequest.querystring("order")==[thecolor]
> lcOrder= [1]
> .
> .
> .
>ENDCASE
>(the rest of code)...
>
>The problem is attemp to order the resulted page, when click the column
>header...how to store the "item_id" selected in the link code for each
>column?.Manually is ok:
><%= oProp.ScriptPath+[?action=]+oProp.Action+[&item_id=]+'02'+[&order=]+'cmarca'
>
>Thaks for your help....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform