cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables to a report

Former Member
0 Kudos

Post Author: Swimmy

CA Forum: .NET

I have a simple application that asks for some information, performs a calculation, and reports the result. I do not need to attach to any database. How do I pass the variables over to a one page report to give the user a hard copy? Seems like it should be easy, I can't find any help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Post Author: BenS

CA Forum: .NET

Ah, I see what you mean. Unfortunatly, to my knowledge...a Crystal report requires some sort of "Result Set" to work off of. I did a quick look around for you on this, and I don't see how you can accomplish what you want without sending the report a result set.

Your only option (if you have to go with Crystal), is to create a DataSet/Table with your information, and link that into your Report. But if Crystal is not mandatory, and your report itself is relatively simply, you might want to consider outputting the data to the printer manually.

I could be wrong, and maybe someone out here might know of a way to do what you are looking for, but I don't...sorry.

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: Swimmy

CA Forum: .NET

Thanks for the reply Ben. I don't think I was clear explaining my problem. Visualize a small application that calculates a payment for a loan. Form 1 asks for the amount, interest rate, and number of months. User presses OK and form 2 shows the amount of the monthly payment with a PRINT button at the bottom to make a hard copy.

AMOUNT BORROWED - (variable from VB app)

INTEREST RATE - (variable from VB app)

PAYMENT - (calculated in VB app.)

There is no dataset, parameters or list. Just 3 variables from the application.

Jim

Former Member
0 Kudos

Post Author: BenS

CA Forum: .NET

Step 1: Create a ParameterField in your report, set the DataType of the parameter and add values to the "Values" list section (if needed).Step 2: Set "Value Options" as neededStep 3: Click OKStep 4: In Visual Studio, Use The Following Code...

'**************************************' Initialize Variables'**************************************Dim objParamField As New CrystalDecisions.Shared.ParameterFieldDim objParamFields As New CrystalDecisions.Shared.ParameterFieldsDim objParameter As New CrystalDecisions.Shared.ParameterDiscreteValueDim objReport As New MyReport

'**************************************' 'Set Up Your Parameter Value(s)'**************************************objParamField.Name = "MyParameter"objParameter.Value = "MyParameterValue"objParamField.CurrentValues.Add(objParameter)objParamFields.Add(objParamField)

'**************************************' 'Pass Parameters To CrystalViewer'**************************************CRViewer.ParameterFieldInfo = objParamFields

'**************************************' ' Pass DataSet To Report' Perform Any Other Needed Operations' Display Report'**************************************

Hope this helps!