Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

DW Sort changes order even if values are the same?

2 posts in DataWindow .NET Last posting was on 2004-12-09 23:43:56.0Z
Daniel Mullings Posted on 2004-12-09 22:44:05.0Z
Sender: 60fe.41b8ce74.1804289383@sybase.com
From: Daniel Mullings
Newsgroups: sybase.public.datawindow.net
Subject: DW Sort changes order even if values are the same?
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <41b8d535.61af.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 9 Dec 2004 14:44:05 -0800
X-Trace: forums-1-dub 1102632245 10.22.241.41 (9 Dec 2004 14:44:05 -0800)
X-Original-Trace: 9 Dec 2004 14:44:05 -0800, 10.22.241.41
Lines: 27
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:950
Article PK: 125374

We have a datawindow created in powerbuilder and we are
trying to migrate the functionality into a vb .net
application.

We are having to issues trying to duplicate that
functionlity.

The SQL statement has some joins, grouping, and an order by
and the presentation layer has grouping and sorting. We
took the SQL statement and started with that, then we tried
to add the sort from the preso layer into the sql statement
and we can't get the same results.

We do have one question though that if answered might solve
our problem:
We removed the sort on the preso layer, and we do the
retrieve to get our result. Then we add one sort criteria
value to the datawindow where all the values are the same
for that sort.
Why does the sort order change? It shouldn't if all the
values are equal. We even tried it on a datawindow from
scratch (using the same SQL statement though). Is the sort
from the SQL statement rerun when the sort is added to the
preso layer? What's the logic behind the sorting and
grouping in the preso layer on the datawindow?

Thanks


Jim O'Neil [Sybase] Posted on 2004-12-09 23:43:56.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.datawindow.net
Subject: Re: DW Sort changes order even if values are the same?
Message-ID: <dgohr052dvadnm8tv26tbikd4csen3ickd@4ax.com>
References: <41b8d535.61af.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpn-concord-068.sybase.com
X-Original-NNTP-Posting-Host: vpn-concord-068.sybase.com
Date: 9 Dec 2004 15:43:56 -0800
X-Trace: forums-1-dub 1102635836 158.159.8.68 (9 Dec 2004 15:43:56 -0800)
X-Original-Trace: 9 Dec 2004 15:43:56 -0800, vpn-concord-068.sybase.com
Lines: 45
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:956
Article PK: 125384

Basically what you've discovered is that the sort used in PowerBuilder
is not stable - meaning the order of equal elements is not preserved.
Some sort algorithms are stable, some or not... in particular, one of
the more common, better performing sorts - QuickSort - is not stable.
I suspect that's what PB uses under the covers.

As for using a sort in the preso layer (by which I'm assuming you mean
the painter versus runtime), you can eliminate the need to call a sort
within your code. Additionally, it's a convenience when reviewing
data or saving data statically with the datawindow object.

In general though if you only need the data sorted once upon
retrieval, I would suggest doing that as part of the SQL, the database
engine is going to be better tuned to doing sorts than PB.

On 9 Dec 2004 14:44:05 -0800, Daniel Mullings wrote:

>We have a datawindow created in powerbuilder and we are
>trying to migrate the functionality into a vb .net
>application.
>
>We are having to issues trying to duplicate that
>functionlity.
>
>The SQL statement has some joins, grouping, and an order by
>and the presentation layer has grouping and sorting. We
>took the SQL statement and started with that, then we tried
>to add the sort from the preso layer into the sql statement
>and we can't get the same results.
>
>We do have one question though that if answered might solve
>our problem:
>We removed the sort on the preso layer, and we do the
>retrieve to get our result. Then we add one sort criteria
>value to the datawindow where all the values are the same
>for that sort.
>Why does the sort order change? It shouldn't if all the
>values are equal. We even tried it on a datawindow from
>scratch (using the same SQL statement though). Is the sort
>from the SQL statement rerun when the sort is added to the
>preso layer? What's the logic behind the sorting and
>grouping in the preso layer on the datawindow?
>
>Thanks