473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query on DataView.Sort Property

Hi,

I am using the DataView.Sort Property (on a DataView column) to sort
the View based on some condition.

Now the column that I need to sort contains characters and HTML code
that should not be considered when sorting is done. (e.g. -> <B>,
<FONT ...>, " , ' , etc...).
To illustarte:
Example 1
<B>This is a...</B> should be sorted as -> This is a... (disregard the
<B>)

Example 2
"Hello friends..." should be sorted as -> Hello friends... (disregard
the ")

The DataColumn.Expression Property does not support "PATINDEX". It
supports SUBSTRING & LEN though.

And I do not want to do this sorting in the SQL SP. Any pointers will
be appreciated.

Thanks for your time.

Cheerz,
Denzil
Jul 21 '05 #1
1 2140
Hi,

Off the top of my head, maybe a solution would be to add a extra column to
the dataset (not the database) and put the clean text in the column. After
calling Fill() you can add the column and run through the records cleaning
the data ie. remove unwanted tags and punctuation etc. and putting the clean
text into the new column. Then you can use this 'cleaned' column as the sort
column.

Thinking about this solution I got another idea for populating the cleaned
column, I am sure it will *not* give great performance, but the code is
simpler. (And interesting, I was not sure it would work so I tested it).

Fill the DataSet using FillSchema( ds, SchemaType.Mapped ), then add the
column to the DataTable and add an event handler for the RowChanged event.
Then call Fill to populate the DataSet. As the DataTable in the DataSet is
populated the RowChanged events fires for each new row added by the Fill
procedure, if the event action is DataRowAction.Add clean the text of the
source column and set the value of the 'cleaned' column to the cleaned text.
Watch out, the event will fire twice because of the changing of the column
value so it is important to check the action.

Hope that helps

Chris Taylor

"Denzil" <de***********@lycos.com> wrote in message
news:29**************************@posting.google.c om...
Hi,

I am using the DataView.Sort Property (on a DataView column) to sort
the View based on some condition.

Now the column that I need to sort contains characters and HTML code
that should not be considered when sorting is done. (e.g. -> <B>,
<FONT ...>, " , ' , etc...).
To illustarte:
Example 1
<B>This is a...</B> should be sorted as -> This is a... (disregard the
<B>)

Example 2
"Hello friends..." should be sorted as -> Hello friends... (disregard
the ")

The DataColumn.Expression Property does not support "PATINDEX". It
supports SUBSTRING & LEN though.

And I do not want to do this sorting in the SQL SP. Any pointers will
be appreciated.

Thanks for your time.

Cheerz,
Denzil

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
9
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a...
1
by: Denzil | last post by:
Hi, I am using the DataView.Sort Property (on a DataView column) to sort the View based on some condition. Now the column that I need to sort contains characters and HTML code that should not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.