473,320 Members | 1,828 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,320 software developers and data experts.

Question about data filtering in Crystal Report

Ray
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray
Nov 21 '05 #1
6 5129
Hi Ray,

Can we see some code?

Bernie Yaeger

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray

Nov 21 '05 #2
Ray
Dear Bernie,
Here is the code.

## Code for define the Report Document
Dim ReportDoc As New ReportDocument
Dim pfieldname As String = "abc"
Dim StrReport As String = ""
StrReport = "E:\test.rpt"
ReportDoc.Load(StrReport)
For Each table In ReportDoc.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = "SERVER"
.DatabaseName = "Sea"
.UserID = "admin"
.Password = "abcd3"
End With
table.ApplyLogOnInfo(logoninfo)
Next table
ReportDoc.RecordSelectionFormula = "{TableName.fieldname} = """ &
pfieldname & """"
Dim Form As New frmPrintForm(temp, ReportDoc, blnPrintsw)
Form.Show()
###################################

I have created another form and put the crystalreportviewer on it. I pass
the ReportDocument defined by the code above to this form and the code is
Me.CRViewer.ReportSource = ReportDoc

Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwellinc.com> ¦b¶l¥ó
news:uM*************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Hi Ray,

Can we see some code?

Bernie Yaeger

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray


Nov 21 '05 #3
Hi Ray,

OK, looked at the code. When you call the report the second time, what is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would have
to be the same (ie, abc).

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray

Nov 21 '05 #4
Ray
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the text
box and call the report again. For this time, the necessary data cannot be
filtered out.
It seems that the report's data has been filtered to the data in the first
time, and since the data in the second time is not within the data in the
first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwellinc.com> ¦b¶l¥ó
news:eE**************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would have to be the same (ie, abc).

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray


Nov 21 '05 #5
Hi Ray,

No, the code looks fine.

Does the report use a physical table, a view, an sp or a dataset to report.
I understand your point about it having been already filtered - that could
only happen, I think (since the report is closed and then again opened), if
the report is using a dataset/datatable as its source.

Try this: in the second pass, use the same pfieldname; if it works, then you
are correct and the data is filtered and has remained filtered. But that
would mean that the report is using a dataset/datatable. Once we know this,
we should be able to fix it.

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:Ow**************@tk2msftngp13.phx.gbl...
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the
text
box and call the report again. For this time, the necessary data cannot be
filtered out.
It seems that the report's data has been filtered to the data in the first
time, and since the data in the second time is not within the data in the
first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwellinc.com> ¦b¶l¥ó
news:eE**************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what
is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would

have
to be the same (ie, abc).

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
> Hi all,
> While I use the ReportDocument of vb.net to set filter to the data to
> the
> Crystal Report, it is successful for the first time while running the
> program. However, for the second time while running the program, when I
> set
> filter to other set of data, all the data is lost.
>
> Please help.
> Thanks a lot,
> Ray
>
>



Nov 21 '05 #6
Ray
Dear Bernie,
Yes, if the same pfieldname is used. The same data will be filtered. How
to fix the problem?
Thanks,
Ray
"Bernie Yaeger" <be*****@cherwellinc.com> ¦b¶l¥ó
news:eg**************@TK2MSFTNGP15.phx.gbl ¤¤¼¶¼g...
Hi Ray,

No, the code looks fine.

Does the report use a physical table, a view, an sp or a dataset to report. I understand your point about it having been already filtered - that could
only happen, I think (since the report is closed and then again opened), if the report is using a dataset/datatable as its source.

Try this: in the second pass, use the same pfieldname; if it works, then you are correct and the data is filtered and has remained filtered. But that
would mean that the report is using a dataset/datatable. Once we know this, we should be able to fix it.

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:Ow**************@tk2msftngp13.phx.gbl...
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the
text
box and call the report again. For this time, the necessary data cannot be filtered out.
It seems that the report's data has been filtered to the data in the first time, and since the data in the second time is not within the data in the first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwellinc.com> ¦b¶l¥ó
news:eE**************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what
is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would

have
to be the same (ie, abc).

Bernie

"Ray" <so*****@microsoft.com> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
> Hi all,
> While I use the ReportDocument of vb.net to set filter to the data to > the
> Crystal Report, it is successful for the first time while running the
> program. However, for the second time while running the program, when I > set
> filter to other set of data, all the data is lost.
>
> Please help.
> Thanks a lot,
> Ray
>
>



Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: AMeador | last post by:
I have, at one point in time, been a pretty good programmer, but that was years ago. I can pass programming classes with and A with no problem, but writting a business class application is a bit of...
3
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop...
1
by: Brad Allison | last post by:
Okay, after spending the past 4 1/2 hours trying to figure this out I am getting some answers but I am also getting very frustrated. And again, if this is the wrong forum to post to I apologize. ...
0
by: Ray | last post by:
Hi all, While I use the ReportDocument of vb.net to set filter to the data to the Crystal Report, it is successful for the first time. However, for the second time, when I set filter to other set...
0
by: Ray | last post by:
Dear Bernie, Yes, if the same pfieldname is used. The same data will be filtered. But I only use the code shown you before. I have not used any dataset or datatable. How to fix the problem?...
3
by: Chubbly Geezer | last post by:
I'm using a particular font (for credit card symbols) within a crystal report which looks fine when I preview, however when I run the report with real data, the font is now shown correctly. It...
1
by: mike11d11 | last post by:
For some reason I'm getting no data populating in my crystal report. I built my crystal report off my dataset in my project, and I fill the dataset when opening the main form, and count the...
0
by: Sheryl 37 | last post by:
Can any1 give me the coding for the following problem.....How to i filter data in Crystal Report using a combo option (e.g Company Name). There1 combo box for the Company, and a crystal report....
1
by: narpet | last post by:
Hello all... I have a C# forms application that I am developing using MS Visual Studio 2005. I am trying to add some Crystal Reports to this application using the built in Crystal Reports tools...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...

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.