External Filter items order

This public forum is for user-to-user discussions of PHP Report Maker. Note that this is not support forum.

External Filter items order

Postby leontet » Wed Jul 26, 2017 2:54 am

Hello again!

I made a report using an external filter on a table that requires search criteria.
I chose the combo box display and the filter dialog populates it correctly with all the discrete values of the corresponding field.
The data type of the field of interest is string (no string function though).
Anyway, the order of the combo box contents is always ascending, no matter what I pick in the "order" option of the external filter.
The problem is I need those values ordered descendantly.

Is it possible to be done? And if yes, how???

Thank you in advance!
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: External Filter items order

Postby Webmaster » Wed Jul 26, 2017 10:03 am

Open <report>info.php with a text editor. Search for the function "SetupLookupFilters" and change the line marked with *** manually:

function SetupLookupFilters($fld) {
global $gsLanguage;
switch ($fld->FldVar) {
case "x_<FieldName>":
//...
//***$sSqlWrk .= " ORDER BY `<FieldName>` ASC";
$sSqlWrk .= " ORDER BY `<FieldName>` DESC"; //***


Alternatively, update to the latest version (10.0.3), then click [Tools] -> [Update Template]. In [Field Settings], set [Extended Filter] -> [Order] = "DESC".
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm

Re: External Filter items order

Postby leontet » Thu Jul 27, 2017 12:12 am

Thank you for your quick reply!

The manual trick works (obviously!), but in the final project that means it has to follow each regeneration of the files.

I installed version 10.0.3 and applied the latest template to no avail (from this point of view): sorting of External Filter contents is ALWAYS ascending.
This behaviour occurs for numeric contents of these filters too.

The lines of code that need to be modified manually to change the order always contain ASC at their end, no matter the chosen option in Field/ExtendedFilter/Order, so I suppose it's a tiny bug that prevents the correct generation of the <report>info.php files.
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: External Filter items order

Postby Webmaster » Thu Jul 27, 2017 10:13 am

It should work. Please make sure that you have Administrator rights when updating the template. Note that you need to be a registered user to use [Tools] -> [Update Template].
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm

Re: External Filter items order

Postby leontet » Sat Jul 29, 2017 5:14 pm

good news: I updated the template again and now everything works perfect!
So, issue SOLVED!!!

Thank you very, very much, for your invaluable help!!!
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am


Return to General Discussion (PHP Report Maker)