Complex (ish) RowFilter

  • Thread starter Thread starter Rob Oldfield
  • Start date Start date
R

Rob Oldfield

I have a field of information in an SQL database that is of the format
'users initials' (padded to 3 characters with a space if necessary) followed
by a sequential number. For example JS 123 would be record 123 for the user
John Smith. How can I organise a dataview so that it is sorted firstly by
the initials, and then by the numeric value?

I think that I need to add a calculated column onto the datatable and then
sort by that, but how do I pick out 'value of the 4 character onwards'?
 
Hi Rob,

Just a suggestion - the SQL expressions for calculated columns support
several string manipulation functions, as far as I remember. You could
probably employ them to pick out the value.
 
Yes. I'd actually figured that one out after I made the original post.

The problem is that I have masses of references to the table name and if I
create a view to do the calculation then I'm going to either have to change
all of those or kick my current users out while I change the name of the
table and create the view with the original table name. I was hoping to be
able to avoid the trouble of either.

Thanks for the suggestion though. I'm thinking that it's probably going to
be more efficient to do the processing in SQL anyway, so I'll probably go
with your idea.

--
For real reply address, replace the _surprised_ bits with dots
www.realuk.co.uk


Dmitriy Lapshin said:
Hi Rob,

Just a suggestion - the SQL expressions for calculated columns support
several string manipulation functions, as far as I remember. You could
probably employ them to pick out the value.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Rob Oldfield said:
I have a field of information in an SQL database that is of the format
'users initials' (padded to 3 characters with a space if necessary) followed
by a sequential number. For example JS 123 would be record 123 for the user
John Smith. How can I organise a dataview so that it is sorted firstly by
the initials, and then by the numeric value?

I think that I need to add a calculated column onto the datatable and then
sort by that, but how do I pick out 'value of the 4 character onwards'?
 
Back
Top