One correction, delete the <@ASSIGN NAME="vsortorder" VALUE="" SCOPE="user"> line before the first if statement or the sortorder will only sort on one column.
-----Original Message----- From: Ted Wolfley [mailto:[email protected]] Sent: Tuesday, March 02, 2010 8:32 AM To: [email protected] Subject: RE: Witango-Talk: Multiple Sorts Here is a quick example, all in a Results Action: order of columns returned: company, lname, state, customerid build the sort: ASSIGN NAME="vsortorder" VALUE="" SCOPE="user"> <@IF EXPR="<@ARG sort>= 1"> <@COMMENT>company</@COMMENT> <@IFEMPTY VALUE="@@request$vsortorder"> <@ASSIGN NAME="vsortorder" VALUE="1 NUM ASC" SCOPE="user"> <@else> <@ASSIGN NAME="vsortorder" VALUE="1 NUM ASC, <@VAR vsortorder SCOPE=User> " SCOPE="user"> </@IF> <@ELSEIF EXPR="<@ARG sort>= 2"> <@COMMENT>lname</@COMMENT> <@IFEMPTY VALUE="@@request$vsortorder"> <@ASSIGN NAME="vsortorder" VALUE="2 NUM ASC" SCOPE="user"> <@else> <@ASSIGN NAME="vsortorder" VALUE="2 NUM ASC, <@VAR vsortorder SCOPE=User> " SCOPE="user"> </@IF> <@ELSEIF EXPR="<@ARG sort>= 3"> <@COMMENT>state</@COMMENT> <@IFEMPTY VALUE="@@request$vsortorder"> <@ASSIGN NAME="vsortorder" VALUE="3 NUM ASC" SCOPE="user"> <@else> <@ASSIGN NAME="vsortorder" VALUE="3 NUM ASC, <@VAR vsortorder SCOPE=User> " SCOPE="user"> </@IF> <@ELSEIF EXPR="<@ARG sort>= 4"> <@COMMENT>customerid</@COMMENT> <@IFEMPTY VALUE="@@request$vsortorder"> <@ASSIGN NAME="vsortorder" VALUE="4 NUM ASC" SCOPE="user"> <@else> <@ASSIGN NAME="vsortorder" VALUE="4 NUM ASC, <@VAR vsortorder SCOPE=User> " SCOPE="user"> </@IF> <@ELSE> <@COMMENT>default</@COMMENT> <@ASSIGN NAME="vsortorder" VALUE="" SCOPE="user"> </@IF> Sort the results set, checking if there is results first or it will error: <@IFEMPTY VALUE="@@request$ResultSet"> <@else> <@IFEMPTY VALUE="@@request$vsortorder"> <@else> <@SORT ARRAY="ResultSet" scope="request" COLS="<@VAR vsortorder SCOPE=User>"> </@IF> </@IF> I did the example in ascending order, it can also be done in descending or both directions, just add additional <@elseif> to the sortorder statements. Ted -----Original Message----- From: WebDude [mailto:[email protected]] Sent: Tuesday, March 02, 2010 7:31 AM To: [email protected] Subject: RE: Witango-Talk: Multiple Sorts Well... That's the way I do it. But it seems that you cannot have a blank variable or multiple sorts within 1 variable... Or am I missing something here. Do you have an example? -----Original Message----- From: Ted Wolfley [mailto:[email protected]] Sent: Monday, March 01, 2010 10:13 PM To: [email protected] Subject: RE: Witango-Talk: Multiple Sorts I found it better and faster to do the sort after the results are returned in the Results Action. Use a user variable and keep appending to the beginning, then use the variable in the sort tag. Remember to have a way to clear the sort and the variable Ted -----Original Message----- From: WebDude [mailto:[email protected]] Sent: Mon 3/1/2010 7:29 PM To: [email protected] Subject: Witango-Talk: Multiple Sorts Typically in the past, I load a sort into a variable and then add that variable as a sort in the search function... I then use an argument to change the sorts... <@IFEQUAL <@ARG sort> "1"><@ASSIGN sort "company_info.company">/@IF <@IFEQUAL <@ARG sort> "2"><@ASSIGN sort "company_info.lname">/@IF <@IFEQUAL <@ARG sort> "3"><@ASSIGN sort "company_info.state">/@IF <@IFEQUAL <@ARG sort> "4"><@ASSIGN sort "company_info.customer_id">/@IF I've been going around and around on this... is there anyway to hold onto the sorts so, let's say, they click on Company first, and then click on last name, they get a sort by lname, company. An thus, if they click next on State, they get a sort of state, lname, company... and so on. I'm sure this has comeup before... I just can't find the answer. Thanks! ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
