Crystal Reports - Parameters runtime customization 
Author Message
 Crystal Reports - Parameters runtime customization

Can anyone help me with this... I put a parameter field into my report. The
name of the field is "Customer Name" and it's a string. Then I wanted to
fill the parameter's value from my C# program. I did it like this:

ParameterFields paramFields = new ParameterFields ();
ParameterField paramField = new ParameterField ();
ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();
paramField.ParameterFieldName = "Customer Name";
discreteVal.Value = "John Wayne";
paramField.CurrentValues.Add(discreteVal);
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
crystalReportViewer1.ReportSource = new MyReport();

What I want now, when user shows the report, is NOT TO show him prompt
dialog which asks him to enter a value for the parameter, but to use the
value "John Wayne" that I assigned in my program. MSDN help says that
ParameterFields should be set before ReportSource value of
CrystalReportViewer and I did it, but it still keeps showing the prompt
dialog. Right now, it only helps me to press Cancel button on the prompt
dialog, but that solution is not acceptable.

Thanx in advance! Milovan.



Wed, 22 Jun 2005 18:45:04 GMT  
 Crystal Reports - Parameters runtime customization
Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
There is plenty of code for you to copy and paste from.

www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

I hope this helps.

Brian Bischof
--
Moving from VB6 to .NET? It just got easier...
"The .NET Languages: A Quick Translation Guide"
 http://www.amazon.com/exec/obidos/ASIN/1893115488


Quote:
> Can anyone help me with this... I put a parameter field into my report.
The
> name of the field is "Customer Name" and it's a string. Then I wanted to
> fill the parameter's value from my C# program. I did it like this:

> ParameterFields paramFields = new ParameterFields ();
> ParameterField paramField = new ParameterField ();
> ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();
> paramField.ParameterFieldName = "Customer Name";
> discreteVal.Value = "John Wayne";
> paramField.CurrentValues.Add(discreteVal);
> paramFields.Add(paramField);
> crystalReportViewer1.ParameterFieldInfo = paramFields;
> crystalReportViewer1.ReportSource = new MyReport();

> What I want now, when user shows the report, is NOT TO show him prompt
> dialog which asks him to enter a value for the parameter, but to use the
> value "John Wayne" that I assigned in my program. MSDN help says that
> ParameterFields should be set before ReportSource value of
> CrystalReportViewer and I did it, but it still keeps showing the prompt
> dialog. Right now, it only helps me to press Cancel button on the prompt
> dialog, but that solution is not acceptable.

> Thanx in advance! Milovan.



Thu, 23 Jun 2005 06:46:42 GMT  
 Crystal Reports - Parameters runtime customization
Brian,

thank you very much! I will have a look at your book.


Quote:
> Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
> There is plenty of code for you to copy and paste from.

> www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

> I hope this helps.

> Brian Bischof
> --
> Moving from VB6 to .NET? It just got easier...
> "The .NET Languages: A Quick Translation Guide"
>  http://www.amazon.com/exec/obidos/ASIN/1893115488



Thu, 23 Jun 2005 16:44:29 GMT  
 Crystal Reports - Parameters runtime customization
Brian,

I had a look at your book, and as you can see in my first post, I wrote
EXACTLY
the same code, with every instruction in the same order as it is in your
code.
But, it still keeps showing that annoying prompt dialog which asks for
parameter values. :-( I tried both solutions - the one with
CrystalReportsViewer
and the one with ReportDocument but I had no luck.

The report uses the value I passed it from my program, but only when I click
Cancel button on the promp dialog. Am I doing something wrong?

    Milovan.


Quote:
> Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
> There is plenty of code for you to copy and paste from.

> www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

> I hope this helps.

> Brian Bischof
> --
> Moving from VB6 to .NET? It just got easier...
> "The .NET Languages: A Quick Translation Guide"
>  http://www.amazon.com/exec/obidos/ASIN/1893115488



Thu, 23 Jun 2005 17:40:40 GMT  
 Crystal Reports - Parameters runtime customization
I later had a look at your code and couldn't see a problem either. Maybe the
parameter name is off a little bit? What about running the code under
Mapping Parameter Classes and seeing what it tells you about your
parameters. You might see something in the name or data type that you didn't
notice.

-Brian
 www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403


Quote:
> Brian,

> I had a look at your book, and as you can see in my first post, I wrote
> EXACTLY
> the same code, with every instruction in the same order as it is in your
> code.
> But, it still keeps showing that annoying prompt dialog which asks for
> parameter values. :-( I tried both solutions - the one with
> CrystalReportsViewer
> and the one with ReportDocument but I had no luck.

> The report uses the value I passed it from my program, but only when I
click
> Cancel button on the promp dialog. Am I doing something wrong?

>     Milovan.



> > Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
> > There is plenty of code for you to copy and paste from.

> > www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

> > I hope this helps.

> > Brian Bischof
> > --
> > Moving from VB6 to .NET? It just got easier...
> > "The .NET Languages: A Quick Translation Guide"
> >  http://www.amazon.com/exec/obidos/ASIN/1893115488



Fri, 24 Jun 2005 02:48:57 GMT  
 Crystal Reports - Parameters runtime customization
Brian,

your (and my) code was perfectly o.k. The problem was the place where I put
it. It was in a constructor of the form on which CrystalReportsViewer was.
Now I know that the prompt dialog shows only when the form gets Show()
message, so I put the code in form's Load() event and everything works well.

    Milovan.


Quote:
> Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
> There is plenty of code for you to copy and paste from.

> www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

> I hope this helps.

> Brian Bischof
> --
> Moving from VB6 to .NET? It just got easier...
> "The .NET Languages: A Quick Translation Guide"
>  http://www.amazon.com/exec/obidos/ASIN/1893115488



> > Can anyone help me with this... I put a parameter field into my report.
> The
> > name of the field is "Customer Name" and it's a string. Then I wanted to
> > fill the parameter's value from my C# program. I did it like this:

> > ParameterFields paramFields = new ParameterFields ();
> > ParameterField paramField = new ParameterField ();
> > ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();
> > paramField.ParameterFieldName = "Customer Name";
> > discreteVal.Value = "John Wayne";
> > paramField.CurrentValues.Add(discreteVal);
> > paramFields.Add(paramField);
> > crystalReportViewer1.ParameterFieldInfo = paramFields;
> > crystalReportViewer1.ReportSource = new MyReport();

> > What I want now, when user shows the report, is NOT TO show him prompt
> > dialog which asks him to enter a value for the parameter, but to use the
> > value "John Wayne" that I assigned in my program. MSDN help says that
> > ParameterFields should be set before ReportSource value of
> > CrystalReportViewer and I did it, but it still keeps showing the prompt
> > dialog. Right now, it only helps me to press Cancel button on the prompt
> > dialog, but that solution is not acceptable.

> > Thanx in advance! Milovan.



Fri, 24 Jun 2005 13:56:50 GMT  
 Crystal Reports - Parameters runtime customization
I thought it would be something unusual like that since the code looked
clean. Glad to hear it works.

/Brian
www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403


Quote:
> Brian,

> your (and my) code was perfectly o.k. The problem was the place where I
put
> it. It was in a constructor of the form on which CrystalReportsViewer was.
> Now I know that the prompt dialog shows only when the form gets Show()
> message, so I put the code in form's Load() event and everything works
well.

>     Milovan.



> > Milovan - I explain how to use parameters in Chapter 5 of my free ebook.
> > There is plenty of code for you to copy and paste from.

> > www.CrystalReportsBook.com/rdr.asp?cpgn=ngcs_010403

> > I hope this helps.

> > Brian Bischof
> > --
> > Moving from VB6 to .NET? It just got easier...
> > "The .NET Languages: A Quick Translation Guide"
> >  http://www.amazon.com/exec/obidos/ASIN/1893115488



> > > Can anyone help me with this... I put a parameter field into my
report.
> > The
> > > name of the field is "Customer Name" and it's a string. Then I wanted
to
> > > fill the parameter's value from my C# program. I did it like this:

> > > ParameterFields paramFields = new ParameterFields ();
> > > ParameterField paramField = new ParameterField ();
> > > ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();
> > > paramField.ParameterFieldName = "Customer Name";
> > > discreteVal.Value = "John Wayne";
> > > paramField.CurrentValues.Add(discreteVal);
> > > paramFields.Add(paramField);
> > > crystalReportViewer1.ParameterFieldInfo = paramFields;
> > > crystalReportViewer1.ReportSource = new MyReport();

> > > What I want now, when user shows the report, is NOT TO show him prompt
> > > dialog which asks him to enter a value for the parameter, but to use
the
> > > value "John Wayne" that I assigned in my program. MSDN help says that
> > > ParameterFields should be set before ReportSource value of
> > > CrystalReportViewer and I did it, but it still keeps showing the
prompt
> > > dialog. Right now, it only helps me to press Cancel button on the
prompt
> > > dialog, but that solution is not acceptable.

> > > Thanx in advance! Milovan.



Fri, 24 Jun 2005 15:58:12 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. FYI: Crystal Reports API to retrieve report parameters

2. Using parameters in Crystal Report

3. C# and Crystal Report Parameters

4. crystal report parameters prompting

5. Crystal Reports parameters

6. Using parameters in Crystal Report

7. Crystal Report Parameters not changing

8. Handing over parameters to Crystal Reports

9. Error in Setting Parameter Fields using Crystal Report Active X control in VC++

10. Error in setting parameter field using Crystal Report Actve X control in VC++

11. Problem: Passing Crystal Reports Parameters in code.

12. Creating reports using Crystal reports

 

 
Powered by phpBB® Forum Software