By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

DataView.Rowfilter question

P: n/a
KC
For a DataView.Rowfilter can I use more than one expression? I want to
filter out two different things.

For example can I take:

dv.RowFilter = "MTX <> 'Customer Forcast'"

and

dv.RowFilter = "MTX <> 'Actual vs. Forcast'"

and combine them into one statement?

dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'"

Is this format correct? If not, what's the format?
---
Ken
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Ken,
dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'"
Is this format correct? If not, what's the format? Yes that is the correct format, did you try it? Are you having problems with
that format?

For information on expressions in the DataSet object model see the
DataColumn.Expression help topic.

http://msdn.microsoft.com/library/de...ssiontopic.asp

Hope this helps
Jay
"KC" <yo*@dontneed.this> wrote in message
news:OM*************@TK2MSFTNGP12.phx.gbl... For a DataView.Rowfilter can I use more than one expression? I want to
filter out two different things.

For example can I take:

dv.RowFilter = "MTX <> 'Customer Forcast'"

and

dv.RowFilter = "MTX <> 'Actual vs. Forcast'"

and combine them into one statement?

dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'"

Is this format correct? If not, what's the format?
---
Ken

Nov 20 '05 #2

P: n/a
KC
Yea, that was it, thanks.

I'm trying stuff out with this DataView thing. It doesn't seem like you can
filter columns in a DataView, is that right? I had the impression it was
like creating a View in oracle or sql server - you decide what columns and
rows are shown.

Ken

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Ken,
dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'" Is this format correct? If not, what's the format? Yes that is the correct format, did you try it? Are you having problems

with that format?

For information on expressions in the DataSet object model see the
DataColumn.Expression help topic.

http://msdn.microsoft.com/library/de...ssiontopic.asp
Hope this helps
Jay
"KC" <yo*@dontneed.this> wrote in message
news:OM*************@TK2MSFTNGP12.phx.gbl...
For a DataView.Rowfilter can I use more than one expression? I want to
filter out two different things.

For example can I take:

dv.RowFilter = "MTX <> 'Customer Forcast'"

and

dv.RowFilter = "MTX <> 'Actual vs. Forcast'"

and combine them into one statement?

dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'"
Is this format correct? If not, what's the format?
---
Ken


Nov 20 '05 #3

P: n/a
Ken,
You can filter the rows you see with a DataView, however you will always see
all the rows.

David Sceppa explains how a DataView works and how to use it in his book
"Microsoft ADO.NET - Core Reference" from MS Press.

If you are doing a lot with ADO.NET I strongly recommend Sceppa's book,
which is a good tutorial on ADO.NET as well as a good desk reference once
you know ADO.NET.

Hope this helps
Jay

"KC" <yo*@dontneed.this> wrote in message
news:uN**************@TK2MSFTNGP11.phx.gbl...
Yea, that was it, thanks.

I'm trying stuff out with this DataView thing. It doesn't seem like you can filter columns in a DataView, is that right? I had the impression it was
like creating a View in oracle or sql server - you decide what columns and
rows are shown.

Ken

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Ken,
dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'" Is this format correct? If not, what's the format?

Yes that is the correct format, did you try it? Are you having problems

with
that format?

For information on expressions in the DataSet object model see the
DataColumn.Expression help topic.

http://msdn.microsoft.com/library/de...ssiontopic.asp

Hope this helps
Jay
"KC" <yo*@dontneed.this> wrote in message
news:OM*************@TK2MSFTNGP12.phx.gbl...
For a DataView.Rowfilter can I use more than one expression? I want to
filter out two different things.

For example can I take:

dv.RowFilter = "MTX <> 'Customer Forcast'"

and

dv.RowFilter = "MTX <> 'Actual vs. Forcast'"

and combine them into one statement?

dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs. Forcast'"
Is this format correct? If not, what's the format?
---
Ken



Nov 20 '05 #4

P: n/a
Doh!
You can filter the rows you see with a DataView, however you will always see all the rows.
That should read:

You can filter the rows you see with a DataView, however you will always see
all the columns.

Jay

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uH**************@TK2MSFTNGP10.phx.gbl... Ken,
You can filter the rows you see with a DataView, however you will always see all the rows.

David Sceppa explains how a DataView works and how to use it in his book
"Microsoft ADO.NET - Core Reference" from MS Press.

If you are doing a lot with ADO.NET I strongly recommend Sceppa's book,
which is a good tutorial on ADO.NET as well as a good desk reference once
you know ADO.NET.

Hope this helps
Jay

"KC" <yo*@dontneed.this> wrote in message
news:uN**************@TK2MSFTNGP11.phx.gbl...
Yea, that was it, thanks.

I'm trying stuff out with this DataView thing. It doesn't seem like you

can
filter columns in a DataView, is that right? I had the impression it was
like creating a View in oracle or sql server - you decide what columns and rows are shown.

Ken

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:ec**************@TK2MSFTNGP12.phx.gbl...
Ken,
> dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs.

Forcast'"
> Is this format correct? If not, what's the format?
Yes that is the correct format, did you try it? Are you having problems
with
that format?

For information on expressions in the DataSet object model see the
DataColumn.Expression help topic.

http://msdn.microsoft.com/library/de...ssiontopic.asp
Hope this helps
Jay
"KC" <yo*@dontneed.this> wrote in message
news:OM*************@TK2MSFTNGP12.phx.gbl...
> For a DataView.Rowfilter can I use more than one expression? I want to > filter out two different things.
>
> For example can I take:
>
> dv.RowFilter = "MTX <> 'Customer Forcast'"
>
> and
>
> dv.RowFilter = "MTX <> 'Actual vs. Forcast'"
>
> and combine them into one statement?
>
> dv.RowFilter = "MTX <> 'Customer Forcast' And MTX <> 'Actual vs.

Forcast'"
>
> Is this format correct? If not, what's the format?
> ---
> Ken
>
>



Nov 20 '05 #5

P: n/a
Hi Jay,
You can filter the rows you see with a DataView, however you will always

see all the columns.

I saw it, however had no anwser because the columns are only visible when a
binded control is used that shows default all columns. (datagrid,
crystalreports, vendors controls).

And than are in those controls columns filters to select the right one.

It is not as a kind of SQL view.

Difficult problem how to tell it in the right context.

Maybe it can be like this.

When you using a rowfilter, than only the not filtered rows are available in
the dataview, however all the columns.

Cor

Nov 20 '05 #6

P: n/a
Cor,
Thank you for the information, I was simply correcting a typo I made.
I saw it, however had no anwser because the columns are only visible when a
All the columns are "visible" from code via the DataRowView.Item property
also!

It really depends on how you translate "visible".

I understand KC is effectively asking for a "ColumnFilter" property that
accepts a comma separated list of fields, so only those fields are "seen"
via the DataRowView.Item property. There is no such property.

If however KC binding the view to a DataGrid, the DataGrid itself has a
column collection avaible to control which columns are shown.

Hope this helps
Jay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Hi Jay,
You can filter the rows you see with a DataView, however you will always see all the columns.

I saw it, however had no anwser because the columns are only visible when

a binded control is used that shows default all columns. (datagrid,
crystalreports, vendors controls).

And than are in those controls columns filters to select the right one.

It is not as a kind of SQL view.

Difficult problem how to tell it in the right context.

Maybe it can be like this.

When you using a rowfilter, than only the not filtered rows are available in the dataview, however all the columns.

Cor

Nov 20 '05 #7

P: n/a
Hi KC,

I understood that you where looking for something like this.
Most code is the creating of the sampleTable.

I hope this helps

Cor
\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Makesampletable()
Dim mycolumns() As String = {"1", "3", "7", "9"}
myproc(mycolumns)
End Sub
Private Sub myproc(ByVal mycolumns() As String)
Dim ts As New DataGridTableStyle
ts.MappingName = "Pieter"
For Each mycolumn As String In mycolumns
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column.MappingName = mycolumn
column.HeaderText = mycolumn
Next
DataGrid1.TableStyles.Add(ts)
End Sub
Private Sub Makesampletable()
Dim dt As New DataTable("Pieter")
For i As Integer = 0 To 9
dt.Columns.Add(i.ToString)
Next
For y As Integer = 1 To 9
Dim dr As DataRow = dt.NewRow
For i As Integer = 0 To 9
dr(i) = i.tostring
Next
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
End Sub
////
Nov 20 '05 #8

P: n/a
KC
Cor,

Thanks!

Ken

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Hi KC,

I understood that you where looking for something like this.
Most code is the creating of the sampleTable.

I hope this helps

Cor
\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Makesampletable()
Dim mycolumns() As String = {"1", "3", "7", "9"}
myproc(mycolumns)
End Sub
Private Sub myproc(ByVal mycolumns() As String)
Dim ts As New DataGridTableStyle
ts.MappingName = "Pieter"
For Each mycolumn As String In mycolumns
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column.MappingName = mycolumn
column.HeaderText = mycolumn
Next
DataGrid1.TableStyles.Add(ts)
End Sub
Private Sub Makesampletable()
Dim dt As New DataTable("Pieter")
For i As Integer = 0 To 9
dt.Columns.Add(i.ToString)
Next
For y As Integer = 1 To 9
Dim dr As DataRow = dt.NewRow
For i As Integer = 0 To 9
dr(i) = i.tostring
Next
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
End Sub
////

Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.