close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problem with empty value and descending sort function

Thread began 3/11/2013 6:12 am by Noa2086 | Last modified 3/12/2013 4:16 pm by Noa2086 | 364 views | 4 replies |

Noa2086

Problem with empty value and descending sort function

Hi!

I would like to order my prices from low to high. When a value is empty, then it means "on demand". Now it is smart when the "on demand" prices would be at the end of the sort list.
At the moment they are at the top of the sort list.

How can i get the empty values at the end of a descending price sort list?

Thx for your help!

Kind Regards
Roman

Sign in to reply to this post

Jason ByrnesWebAssist

use COALESCE(). ORDER BY COALESCE(price,999999) will return the value of the price column if it is set, or 999999 if it is null



SELECT * FROM items ORDER BY COALESCE(price,999999) ASC

Sign in to reply to this post

Noa2086

Hi jason!

thx for your quick answer. This is a good solution thank you.

how can i integrate it in the wa dataassist sort?

$WADA_Sort_1 = new WADA_SortObject();
$WADA_Sort_1->DefaultSort = "ORDER BY Fahrzeugbezeichnung ASC";
$WADA_Sort_1->ColumnList = "".$_GET['Fahrzeuge_Aufsteigend']."";
$WADA_Sort_1->SortOrderList = "Ascending";
$WADA_Sort_1->ToggleOn = false;
if ((isset($_GET['Fahrzeuge_Aufsteigend']) && $_GET['Fahrzeuge_Aufsteigend'] != "")) {
$WADA_Sort_1->SetToClause = $WADA_Sort_1->getDefaultSetToClause();
if ($WADA_Sort_1->ToggleOn && isset($_SESSION["SortierenFahrzeugeAufsteigend"])) {
$WADA_Sort_1->ToggleClause = $_SESSION["SortierenFahrzeugeAufsteigend"];
}
}
else if (isset($_SESSION["SortierenFahrzeugeAufsteigend"])) {
$WADA_Sort_1->SetToClause = $_SESSION["SortierenFahrzeugeAufsteigend"];
}
$WADA_Sort_1->initialize();
$_SESSION["SortierenFahrzeugeAufsteigend"] = $WADA_Sort_1->SetToClause;



the sort function is on a result page.

Sign in to reply to this post

Jason ByrnesWebAssist

change these 2 lines:

php:
$WADA_Sort_1->DefaultSort = "ORDER BY Fahrzeugbezeichnung ASC";

$WADA_Sort_1->ColumnList = "".$_GET['Fahrzeuge_Aufsteigend']."";




to:

php:
$WADA_Sort_1->DefaultSort = "ORDER BY COALESCE(Fahrzeugbezeichnung, 99999) ASC";

$WADA_Sort_1->ColumnList = "".("COALESCE(".$_GET['Fahrzeuge_Aufsteigend'].",999999)")  ."";
Sign in to reply to this post

Noa2086

thx you jason for helping me again!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...