This topic is locked

Dropdown Order By more than one column

5/20/2010 8:49:28 PM
PHPRunner General questions
O
OLDmrcaseyman author

I am using a lookup table for which the "Display Field" is a concat of two fields, "Category" and "Description".

I would like to sort the the displayed values by category and then description. The "Order By" parameter will only let me select one column to sort by.

My results are that the displayed values are sorted properly by category but within the category the descriptions are not sorted.

Does anyone know how I can sort by more than one column?
Thanks!

A
ann 5/21/2010

Hi,
to sort by category and description at once proceed to the SQL mode of the Edit SQL Querytab and create an additional field in the table which is a concat of these two fields. Here is a sample for MySQL:

SELECT

...

CONCAT(Category, "(", Description, ")") AS `Display Field`

...

FROM TableName



Then the 'Display Field' field will be displayed in the Order By option.

O
OLDmrcaseyman author 5/21/2010



Hi,
to sort by category and description at once proceed to the SQL mode of the Edit SQL Querytab and create an additional field in the table which is a concat of these two fields. Here is a sample for MySQL:

SELECT

...

`CONCAT(Category, "(", Description, ")")` AS Display Field

...

FROM TableName



Then the 'Display Field' field will be displayed in the Order By option.


I have added the concat as follows:
SELECT

options_defined_id,

...

Catagory,

Description,

CONCAT(Catagory, "(", Description, ")") AS DisplayField,

Custom_Description,

...

FROM t_options_defined
However, the new field "DisplayField" does not appear in the "Order By" option

Am I doing something wrong?

A
ann 5/24/2010

Hi,
Please make sure you use latest PHPRunner build 5482. If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

O
OLDmrcaseyman author 5/30/2010



Hi,
Please make sure you use latest PHPRunner build 5482. If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.


I am posting the support answer here so that other users understand that the solution suggested above does not work.
The solution I received via email:
Unfortunately PHPRunner do not support calculated fields or aliases in the 'Link field' and 'Order by' dropdowns on the "Edit as settings"->'Lookup wizard' dialog.
As workaround you can create custom view in the database directly and then use this view as lookup table.