This topic is locked

Order by two columns

12/8/2006 12:05:49 PM
PHPRunner General questions
G
GeddyLee author

Hey guys,
I'm running version 3.1 build 175.
I'm using a lookup wizard, and I would like to order my results by two columns. However the order by drop-down seems to only allow me to choose one field.
I tried filling in the WHERE textbox to say "1 = 1 ORDER BY first_name ASC, last_name ASC" but this causes errors because php runner puts ()'s around everything filled into the WHERE box, making my SQL look like WHERE(1 = 1 ORDER BY first_name ASC, last_name ASC). Which is illegal.
I also tried editing the text box to be "1 = 1) ORDER BY first_name ASC, last_name ASC -- " to make the SQL look like WHERE(1 = 1) ORDER BY first_name ASC, last_name ASC -- ). Commenting out the last ) did trick php into working on the view page, however, it broke other pages, such as edit, where additional SQL information came after the ORDER BY clause. All of which got commented out from my --
Any ideas on how to order by two columns in a lookup wizard? Thanks

Admin 12/11/2006

Hi,
adding ORDER BY clasue to Edit bopx won't work.

You need to modify generated PHP files to get the list sorted by two fields.
Open include\commonfunctions.php file with a text editor, find this snippet there:

if($strTableName=="mytable" && $field=="myfield")

{

...

$LookupSQL.=" ORDER BY ...";

...

}



and modify the ORDER BY clause.

G
GeddyLee author 12/11/2006

Hi,

adding ORDER BY clasue to Edit bopx won't work.

You need to modify generated PHP files to get the list sorted by two fields.
Open include\commonfunctions.php file with a text editor, find this snippet there:
and modify the ORDER BY clause.


Thanks Alexey,
So I guess I'll have to make this change every time I build the file, but at least I can have the sort by.