>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.
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
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