Grouping 1st 2 characters (2nd try)

  • Thread starter Thread starter Sjaakie Helderhorst
  • Start date Start date
S

Sjaakie Helderhorst

Hello,
I want to create a Dataview which contains, grouped, the first 2 characters
of a cell-value.
I tried (SQL-Server background):

dv = New DataView(ds.Tables("Product"), _
"distinct left(artcode, 2) group by artcode", _
"artcode", _
DataViewRowState.CurrentRows)

Can someone explain me how to achieve this?
Thanks!
 
Hi Sjaakie,

I think this is one of the wishes from a lot of people what you try to do.
I have untill now not seen a solution for this.

When you see the friendly discussion between me and Peter below you can see
in the given samples, that the dataview is in the rowfilter nothing more
than the datatable.select and visa versa.
It can only say A=B (or more complex comparising)
The sort can only say (a, b Asc)
or (a ASC, b Desc)
etc.

With the rowfilter you can filter (select)
With the sort you can sort
But as often told in dotnet groups it is not a SQL statement.

Untill now I have seen in the dotnet newsgroup only 2 solutions for it, that
are:
to use the SQL select distinct for this and create a seperate datatable
or
to create a seperate array by looping though the table.

I hope this helps anyway?

Cor
 
Sjaakie,
In addition to Cor's comments:

The only place I know of where the syntax that expressions (such as
RowFilter) in the DataSet OM is documented is the DataColumn.Expression help
topic:

http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp


David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS Press
covers using a DataView and every thing else ADO.NET.

David's book is both a good tutorial on ADO.NET plus a good desk reference
once you know ADO.NET!

Hope this helps
Jay
 
Hello,

Thanks for your response.
Since I'm not the only mortal requesting this feature it might be a good
idea to put this on a wishlist.
Is there any?
 
Thanks!

Jay B. Harlow said:
Sjaakie,
In addition to Cor's comments:

The only place I know of where the syntax that expressions (such as
RowFilter) in the DataSet OM is documented is the DataColumn.Expression help
http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp


David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS Press
covers using a DataView and every thing else ADO.NET.

David's book is both a good tutorial on ADO.NET plus a good desk reference
once you know ADO.NET!

Hope this helps
Jay
 
Back
Top