This topic is locked

Dual Sort

11/29/2007 4:57:24 PM
ASPRunnerPro General questions
M
mfred author

I have a request to have a list sort according to content in a field. If the status field for a record reads as "In Progress", order by .... If the status field for a record reads "In Progress - Assigned", order by the assigned name. I can envision this as an if statement but I don't know what to write or where to put it.

M
Michael7 11/29/2007

Can you not just do...
"ORDER BY [ProgressFieldName] ASC, [AssignedName] ASC"
If this will do just change it on the TableList screen In ASPrunner

and select it to order 1st by 'ProgressFieldName' then by 'AssignedName'
or just add the code direct to
output/include/yourproject_variables.asp
gstOrderBy=""
replace with

gstrOrderBy="ORDER BY [ProgressFieldName] ASC, [AssignedName] ASC"
Michael

M
mfred author 11/30/2007

What I was meaning was that lines with status as "In Progress" would sort 1 way, which fits with what you noted. And I have it set so that status sorts first so all "In Progress - Assigned" lines are grouped separately. The catch is they want the second 'ordered by' to change when the status is changed. Specifically, "In Progress" jobs will order by the status field then Zip Code Zone. When The Staus is changed to "In Progress - Assigned", the 'ordered by' will change to status then assigned driver. This is what I meant by dual sort. They want to 'ordered by' criteria, based on the designation 1 a field. Does that clarify?

Sergey Kornilov admin 12/3/2007

I think you can add a calculated field to your query which will hold assigned name when status="In Progress - Assigned" and another value where status field has different value. Then you can sort by this calculated field.