Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Repot RDC and VFP
Message
From
06/04/2002 10:53:17
 
 
To
06/04/2002 10:00:05
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00641797
Message ID:
00641802
Views:
18
>Currently I am developing an application using VFP and crystal reports using RDC. I do not know how to pass parameters from VFP using RDC to crystal report. Can someone help me on this.
>Thanks & Best Regards
>Rajeev

After you open the report, and have your report object, the report object has a ParameterFields collection. Each parameter you put in your report will be in this collection. If you only have one parameter you can just use the first index, if you have more than one you have to determine its index.

Once you have a reference to the parameter object you can use the AddCurrentValue() method to set its value(s).

Here are to methods from my RDC wrapper class that are used to set a parameter, I just pass the parameter name (or index if you know it) and value I want to set it to.
*function setreportparameter
lparameters uParameter, uValueToSet

Local nIndex

If vartype(uParameter) == 'C'
	nIndex = this.GetParameterIndex( uParameter )
Else
	nIndex = uParameter
EndIf

With This.oReport.ParameterFields.Item(nIndex)

	.ClearCurrentValueAndRange()
	.AddCurrentValue( uValueToSet )
	
EndWith

*function getparameterindex
Lparam cName

Local ;
	x,;
	nCount,;
	lFound

With This.oReport.ParameterFields

	nCount = .Count

	For x = 1 to nCount

		If upper(.Item(x).Name) = '{?'+upper(cName)+'}'
			lFound = .t.
			Exit
		Endif

	Next x

	If ! lFound
		x = null
	Endif

	Return x

Endwith
HTH,
BOb
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform