Sort column in datatable
-
Hello, I am programming in VB2005 I have a DataColumn with numbers and '<' sign as following: -10 -5 <-90 <-50 +2 How can I sort this column? Should I add another hided column and sort it? Is there another way to do this?
Shay Noy
-
Hello, I am programming in VB2005 I have a DataColumn with numbers and '<' sign as following: -10 -5 <-90 <-50 +2 How can I sort this column? Should I add another hided column and sort it? Is there another way to do this?
Shay Noy
I suppose the column is of type string (nvarchar/nchar/varchar/etc). How do you want this column to be sorted? In other words, what should the order be in the example you posted?
My advice is free, and you may get what you paid for.
-
I suppose the column is of type string (nvarchar/nchar/varchar/etc). How do you want this column to be sorted? In other words, what should the order be in the example you posted?
My advice is free, and you may get what you paid for.
Like this: <-90 'Smaller than -90 <-50 'Smaller than -50 and that mean that it is bigger that <-90 -10 -5 +2
Shay Noy
-
Like this: <-90 'Smaller than -90 <-50 'Smaller than -50 and that mean that it is bigger that <-90 -10 -5 +2
Shay Noy
You said that you are allowed to add a new column, so I assume that you are free to adapt the table structure. If I were you, I would separate the < and > type characters from this column into its own column. Then transform the original column to type int, and simply adapt any queries or code to take both columns into account instead of only the one. This means that you may have to adapt the query that got the data into this column to begin with, so that it separates the two value types (integers and < / >).
My advice is free, and you may get what you paid for.
-
You said that you are allowed to add a new column, so I assume that you are free to adapt the table structure. If I were you, I would separate the < and > type characters from this column into its own column. Then transform the original column to type int, and simply adapt any queries or code to take both columns into account instead of only the one. This means that you may have to adapt the query that got the data into this column to begin with, so that it separates the two value types (integers and < / >).
My advice is free, and you may get what you paid for.
Thank you
Shay Noy