on 09-05-2014 3:34 PM
in an old vb 6 application we used to be able to call a function called PESetFomula in the Crystal Reports viewer and pass it the name of the parameter and the value.
How do we do that now using Crystal Reports for VS 2013. I don't mean to set the criteria just to pass over parameters and values.
Bill
Hi Bill,
Moving the thread to Crystal reports for Visual Studio Space.
Using the .net SDK you could use the ReportDocument class to pass the parameter values to the report.
See the sample applications here:
http://scn.sap.com/docs/DOC-6929
http://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports+for+.NET+SDK+Samples
The developer guide and the API reference guide is here.
http://scn.sap.com/docs/DOC-7824
- Bhushan
Senior Engineer
SAP Active Global Support
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
Getting started and moving ahead with Crystal Reports .NET applications.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
First, CRPE32 API set has been deprecated, meaning you can no longer use crpe32 as your report engine. It's replacement is the inProc Report Application Server ( RAS ).
But in your case I think you are looking to set parameter values. But if you want to add Formulae here's how to.
For Parameters, search, I've posted sample code on how to.
After looking and testing with the test app's Bhushan directed you to here's how to add formula's. :
CrystalDecisions.ReportAppServer.ObjectFactory.ObjectFactory objFactory = new CrystalDecisions.ReportAppServer.ObjectFactory.ObjectFactory();
CrystalDecisions.ReportAppServer.DataDefModel.FormulaField Formula = (CrystalDecisions.ReportAppServer.DataDefModel.FormulaField)objFactory.CreateObject("CrystalReports.FormulaField");
Formula.Type = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField;
Formula.Syntax = CrystalDecisions.ReportAppServer.DataDefModel.CrFormulaSyntaxEnum.crFormulaSyntaxCrystal;
Formula.Text = @"whilereadingrecords; ""A"""; // "hello Ludek = 1"; // resultField.Text; // "n=3"; {Customer.Customer Credit ID} + 1 @"whilereadingrecords; ""A"""
Formula.Name = "TestDon"; // "TestDon"; // resultField.Name; //"testformula";
String FormulaMessage = rptClientDoc.DataDefController.FormulaFieldController.Check(Formula);
if (FormulaMessage == null)
rptClientDoc.DataDefController.FormulaFieldController.Add(Formula);
else
btnReportObjects.Text += "There are errors in the formula: " + FormulaMessage.ToString() + "\n";
You must use the .Check to validate the formula, if not your reports may not work
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.