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

Crystal reports paramaters

hi,
I'm using Crystal reports to generate a simple report in a VB.net windows
application, I've defined all my stuffs (accessMDB,query, 2 parameters) in
the report design, and it's working fine, when a report is opened it prompts
me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be no
prompt)?
2- How can I use a dataset (that I define by code in my form) as datasource
of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?

note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.

Thanks a lot for your help.
Nov 20 '05 #1
4 2464
You can dynamically set the SelectionFormula property of the reportviewer
and incorporate your params there for instance. You can create a blank
dataset for instance and then base your report on the XML file, just select
it as the DataSource.

Not sure about the connection string. What do you need to do? I can
probably be of more help with number 3 if you let me know.

HTH,

Bill
"touf" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
hi,
I'm using Crystal reports to generate a simple report in a VB.net windows
application, I've defined all my stuffs (accessMDB,query, 2 parameters) in
the report design, and it's working fine, when a report is opened it prompts me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be no prompt)?
2- How can I use a dataset (that I define by code in my form) as datasource of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?

note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.

Thanks a lot for your help.

Nov 20 '05 #2
Hi Touf,

Re parameters, here's some instructional code:
Dim paramFields As New ParameterFields()

Dim paramField As New ParameterField()

Dim discreteVal As New ParameterDiscreteValue()

paramField.ParameterFieldName = "selectedtable"

Select Case gl_browseprintvar ' this is a global variable in my app that
contains the name of the report

Case "f:\imcapps\retcatttable.rpt"

discreteVal.Value = "Retail Categories Table"

Case "f:\imcapps\vendortable.rpt"

discreteVal.Value = "Vendor Table"

Case "f:\imcapps\transittable.rpt"

discreteVal.Value = "Old/New BIPAD Translation Table"

End Select

paramField.ParameterFieldName = "selectedtable"

paramField.CurrentValues.Add(discreteVal)

paramFields.Add(paramField)

CrystalReportViewer1.ParameterFieldInfo = paramFields

All I'm doing here is passing a param that provides the translation for the
report parameter 'selectedtable', which is then displayed in the report as
part of the header.

HTH,

Bernie

"touf" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
hi,
I'm using Crystal reports to generate a simple report in a VB.net windows
application, I've defined all my stuffs (accessMDB,query, 2 parameters) in
the report design, and it's working fine, when a report is opened it prompts me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be no prompt)?
2- How can I use a dataset (that I define by code in my form) as datasource of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?

note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.

Thanks a lot for your help.

Nov 20 '05 #3
Thanks Wiliam,
If i find a way to pass the dataset (question2) i dont need the question3
because I will send all the information from my form as dataset.
Can you please explain me more your suggestions ... give me the steps to
folow for this. can you specifiy for each question ( 1 and 2)

Thanks.
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
You can dynamically set the SelectionFormula property of the reportviewer
and incorporate your params there for instance. You can create a blank
dataset for instance and then base your report on the XML file, just select it as the DataSource.

Not sure about the connection string. What do you need to do? I can
probably be of more help with number 3 if you let me know.

HTH,

Bill
"touf" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
hi,
I'm using Crystal reports to generate a simple report in a VB.net windows application, I've defined all my stuffs (accessMDB,query, 2 parameters) in the report design, and it's working fine, when a report is opened it

prompts
me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be

no
prompt)?
2- How can I use a dataset (that I define by code in my form) as

datasource
of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?

note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.

Thanks a lot for your help.


Nov 20 '05 #4
jim
Hi touf,

this is actually pretty simple. let me try to walk you through the
process.

1.) define your data...

you'll need to define what your dataset is going to look like using an
xml schema file. They're relatively easy to create if you have any
experience with xml. add an xml schema file to your project and use
the xml schema designer in vs.net to define what your dataset is going
to look like.

2.) create your report...

once you have the xml schema file created to represent your dataset,
use it to create your report. Add a crystal report to your project
through the "add new item" project option. In the create new report
wizard, on the data tab select "More Data Sources" - "ADO.NET(XML)".
Point the dialog to the xml schema file you created - "mySchema.xsd"
etc. Then it will be just like creating your report using sql, oracle
or any other data soruce. you'll be able to drag and drop your dataset
fields onto your report etc.

** one note here ** if you decide to change the structure of your
dataset, be sure to update your xsd schema file and update your
report.

3.) when your report file is done, move on to writing your code to
generate your report from your application...

<code>

'--- dataset to hold your data ---'
Dim myData As DataSet
myData.ReadXmlSchema("c:\myDirectory\myReportSchem a.xsd") <-- your
schema file
'--- code to populate your dataset ---'
'--- more code to populate your dataset ---'

Dim report As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
report.Load("c:\myDirectory\myReport.rpt") <-- your report file

'--- set the datasource of your report file to your dataset ---'
report.SetDataSource(myData)

'--- set parameters ---'
Dim prmField As CrystalDecisions.CrystalReports.Engine.ParameterFi eldDefinition
= report.DataDefinition.ParameterFields("myParameter FieldName") (watch
word wrap)

'--- create parameter value collection ---'
Dim prmValueCollection As New CrystalDecisions.Shared.ParameterValues

'--- create object to hold parameter value ---'
Dim prmValue As New CrystalDecisions.Shared.ParameterDiscreteValue

prmValue.Value = "myParameterValue"
prmValueCollection.Add(prmValue)

prmField.ApplyCurrentValues(prmValueCollection)

</code>

this code isn't tested, I'm just puting it together from memory.

of course, your parameter value has to be of the same type as the
parameter defined in your report.

the only downside i experienced creating my project this was that you
can't preview your report with data. since you are creating your
report based off of an xsd schema there is no data to preview. But
this is easily worked around by creating a small viewer application
that uses the crystal reports viewer control.

good luck!

here's a link to a great online reference for creating cr.net
applications by brian bischoff. it helped me greatly when i was first
trying to work my way
through this.

http://www.crystalreportsbook.com/Chapters.asp
jim


"touf" <to******@hotmail.com> wrote in message news:<Oo**************@TK2MSFTNGP10.phx.gbl>...
Thanks Wiliam,
If i find a way to pass the dataset (question2) i dont need the question3
because I will send all the information from my form as dataset.
Can you please explain me more your suggestions ... give me the steps to
folow for this. can you specifiy for each question ( 1 and 2)

Thanks.
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
You can dynamically set the SelectionFormula property of the reportviewer
and incorporate your params there for instance. You can create a blank
dataset for instance and then base your report on the XML file, just

select
it as the DataSource.

Not sure about the connection string. What do you need to do? I can
probably be of more help with number 3 if you let me know.

HTH,

Bill
"touf" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
hi,
I'm using Crystal reports to generate a simple report in a VB.net windows application, I've defined all my stuffs (accessMDB,query, 2 parameters) in the report design, and it's working fine, when a report is opened it prompts me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be no prompt)?
2- How can I use a dataset (that I define by code in my form) as datasource of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?

note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.

Thanks a lot for your help.


Nov 20 '05 #5

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

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
5
by: BStorm | last post by:
I have a transaction log file where the DataSet table's Description column is actually delimited into "subcolumns" based upon the transaction id. I would like to parse these into separate fields...
3
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
0
by: Robert Warnestam | last post by:
Hello, I have some problems deploying Crystal Reports. I'm using Visual Studio 2005 Beta 1. In this version Crystal Reports (9.7.3500.0) is included. I created a small test application...
1
by: Brian Henry | last post by:
is there any way to get a listing of parameters needed by a report object in vb.net? what i need is a listing of all the parameters it needs and their data types... all our reports are stored as...
3
by: VMI | last post by:
I know this may not be the best NG for this, but I feel you guys know more about this than any of the other NGs. I need to build several simple reports (over 50 of them and they get their data...
3
by: Miro | last post by:
Hi, Just wondering what a good book is on visual studios 2008 ( or 2005 if no 2008 ) that teaches you how to properly use crystal reports with it. Or im assuming that as long as I can create a...
1
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.