Fw: Strategy for Sorting in UI

  • Thread starter Thread starter M. A. Naveed
  • Start date Start date
M

M. A. Naveed

well i'm having almost the same problem. I'm displaying page wise records in
an aspx page. (DNA archecture using enterprise service and remoting)

Suppose the user has requested to see data from the customer table. The
customer table may contain 100 or even thousands of records, and I do not
want to fetch all records from the customer table, so I break up the result
into pages of data by using Top 25 Clause in SQL Select Statement and the
result is sorted by a unique column say IdentityColumn, each time when user
hits the next page button the next 25 records are to be fethced from the
table having greater value in unique id field of the last record of the
page.

The above page wise navigation is working fine. Now i'm having a different
scenario which i need to find some solution of it.

Now user wants to sort records at any coulum dislaying in a grid which is
not necessarily be unique. The problem is, which records are to be fetched
when user clicks on the Next Page button, the sorted column may not be
unique this time.

For Example, Homail Inbox, i can change sorting column to any one and
navigate inbox pages accordingly :0)

How do I navigate pages in this situation? im not fetching all the records
from the table, performance issue is critical.
Please comments,

thanks and regards,
M. A. Naveed
(e-mail address removed)


----- Original Message -----
From: Alvin Bruney [MVP]
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Tuesday, March 02, 2004 11:34 AM
Subject: Re: Strategy for Sorting in UI


Your post went unanswered. Have you resolved this issue?
 
You have to do your sort in the database query using a unique value.
However, that unique value doesn't have to be a single column. It can be a
combination of columns. So, for example, if you are sorting by "LastName"
and there may be duplicates, your query might look like the following:

SELECT * FROM myTable
WHERE LastName >= 'Spencer'
AND UniqueID > 420
ORDER BY LastName, UniqueID

You need to pass 2 or more values in order to make a unique value. The "420"
is the UniqueID of the last record returned by the last query.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

M. A. Naveed said:
well i'm having almost the same problem. I'm displaying page wise records in
an aspx page. (DNA archecture using enterprise service and remoting)

Suppose the user has requested to see data from the customer table. The
customer table may contain 100 or even thousands of records, and I do not
want to fetch all records from the customer table, so I break up the result
into pages of data by using Top 25 Clause in SQL Select Statement and the
result is sorted by a unique column say IdentityColumn, each time when user
hits the next page button the next 25 records are to be fethced from the
table having greater value in unique id field of the last record of the
page.

The above page wise navigation is working fine. Now i'm having a different
scenario which i need to find some solution of it.

Now user wants to sort records at any coulum dislaying in a grid which is
not necessarily be unique. The problem is, which records are to be fetched
when user clicks on the Next Page button, the sorted column may not be
unique this time.

For Example, Homail Inbox, i can change sorting column to any one and
navigate inbox pages accordingly :0)

How do I navigate pages in this situation? im not fetching all the records
from the table, performance issue is critical.
Please comments,

thanks and regards,
M. A. Naveed
(e-mail address removed)


----- Original Message -----
From: Alvin Bruney [MVP]
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Tuesday, March 02, 2004 11:34 AM
Subject: Re: Strategy for Sorting in UI


Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Guadala Harry said:
I need to present users with a list - and then let them sort it in any
arbitrary order they like. Each item to be sorted is a short string of
text - there can be up to 50 items to sort. After the users are finished
sorting, the sorted list gets sent back to the server. I'd appreciate any
suggestions for how to accomplish this on the client (minimizing round
trips) - including suggestions for specific UI controls.

Thanks in advance.
 
I have also checked this query by additionally using TOP 25 in SELECT
statement. This almost give the desired output but here is a case what would
you suggest for that:

By this approch i.e. providing a unique value along with the desired sorted
column information, there are certain records which may not returned from
the database.
If there is a record containing LastName='TOM' and a uniqueID=100, this
will never fetch
Similarly all the records in a database which have lesser UniqueID than the
ID of last returned record of the page will never be fetched by this query.
Inshort those records which have value greater than 'Spencer' in lastName
and having lesser value than '420' in UniqueId, will never return.

thanks and regards,

M. A. Naveed
(e-mail address removed)

Sr. Software Engineer
CorrTec Pvt. Ltd. Karachi




Kevin Spencer said:
You have to do your sort in the database query using a unique value.
However, that unique value doesn't have to be a single column. It can be a
combination of columns. So, for example, if you are sorting by "LastName"
and there may be duplicates, your query might look like the following:

SELECT * FROM myTable
WHERE LastName >= 'Spencer'
AND UniqueID > 420
ORDER BY LastName, UniqueID

You need to pass 2 or more values in order to make a unique value. The "420"
is the UniqueID of the last record returned by the last query.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

M. A. Naveed said:
well i'm having almost the same problem. I'm displaying page wise
records
in
an aspx page. (DNA archecture using enterprise service and remoting)

Suppose the user has requested to see data from the customer table. The
customer table may contain 100 or even thousands of records, and I do not
want to fetch all records from the customer table, so I break up the result
into pages of data by using Top 25 Clause in SQL Select Statement and the
result is sorted by a unique column say IdentityColumn, each time when user
hits the next page button the next 25 records are to be fethced from the
table having greater value in unique id field of the last record of the
page.

The above page wise navigation is working fine. Now i'm having a different
scenario which i need to find some solution of it.

Now user wants to sort records at any coulum dislaying in a grid which is
not necessarily be unique. The problem is, which records are to be fetched
when user clicks on the Next Page button, the sorted column may not be
unique this time.

For Example, Homail Inbox, i can change sorting column to any one and
navigate inbox pages accordingly :0)

How do I navigate pages in this situation? im not fetching all the records
from the table, performance issue is critical.
Please comments,

thanks and regards,
M. A. Naveed
(e-mail address removed)


----- Original Message -----
From: Alvin Bruney [MVP]
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Tuesday, March 02, 2004 11:34 AM
Subject: Re: Strategy for Sorting in UI


Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Guadala Harry said:
I need to present users with a list - and then let them sort it in any
arbitrary order they like. Each item to be sorted is a short string of
text - there can be up to 50 items to sort. After the users are finished
sorting, the sorted list gets sent back to the server. I'd appreciate any
suggestions for how to accomplish this on the client (minimizing round
trips) - including suggestions for specific UI controls.

Thanks in advance.
 
Back
Top