473,325 Members | 2,480 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,325 software developers and data experts.

DataView.Rowfilter question

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
8 4758
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ryan Moore | last post by:
I have a dataset (called adset) which has a column called "Large" which is either an integer 0 or 1. I am creating 2 dataviews, one which should display the 1's and one which should display the...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
14
by: Able | last post by:
Dear friends Dim myDataView as DataView = New DataView(dsData.Tables("tblCustomers")) myDataView.RowFilter = "City = 'London'" My question is how to loop through all rows in myDataView and...
3
by: Catullus | last post by:
Hi everyone, I'm a n00b on VB.net programming and now I stumbled upon a problem I can't solve, even after browsing the net for hours.. I have a dataview witg 4 columns; 2 string columns and 2...
7
by: Rich | last post by:
Hello, I am pulling master data from one master table and detail data from two detail tables. The rows from the master data are displayed in textboxes on my form which are bound to the data...
0
by: neeraj | last post by:
Hi, all Could anny one give me help how can I use like operator with these data types "integer , datetime or boolean" in DataView.RowFilter Actually when I try to get the data from dataview...
1
by: AlexW | last post by:
Hi I am in the process of developing an inventory application in visual basic. I keep coming up against a problem with using the dataview.rowfilter property. Basically what happens is this: -a...
5
by: AlexW | last post by:
Hi I am in the process of developing an inventory application in visual basic. I keep coming up against a problem with using the dataview.rowfilter property. Basically what happens is this: -a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.