Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subreports
Message
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Title:
Miscellaneous
Thread ID:
00779750
Message ID:
00779832
Views:
15
loReport should be a reference to the Report Object.

>Hi Dan,
>
>Hey, the report now comes up with the three reports, however, there is no data!
>
>In your original code, I got an error on loReport, so I changed it to oRe.oreport. In the new code you sent for the parameter, I again received an error on loReport. I changed this to loSubReport.
>
>Are my references incorrect?
>
>Thanks,
>
>>I get the parameter via the Parameters collection. Something like this:
>>
>>
>>** loop through each parameter in the report object's
>>** parameter fields collection
>>
>>FOR EACH loCRParameter IN loReport.ParameterFields
>>   ** get the name of the parameter
>>   lcParamName = loCRParameter.ParameterFieldName
>>
>>   IF LOWER(lcParamName) = 'vp_ccase_cid'
>>      loCRParameter.SetCurrentValue(lcCID)
>>   ENDIF
>>
>>ENDFOR
>>
>>
>>>Hi Dan,
>>>
>>>I am not sure how to set the parameter in the sub-report. The .setparameter command apparently is not recognized. Here is the code in the button.click where I call the report:
>>>
>>>
>>>LOCAL lcCID, ;
>>>	oRE
>>>* Create an instance of the report engine
>>>oRE = createobj('reportengine')
>>>With oRE
>>>	* Read reports path from Application object
>>>	.cReportFilePath = This.oApplication.cOutputPath
>>>	* Set report engine connection handle
>>>	.ODBChdbc = SQLGetProp( 1 , 'ODBChdbc' )
>>>	lcCID = V_CASE.cID
>>>	If ! .OpenReport('IndictmentJacket.rpt')
>>>		Messagebox(.cErrorMessage,MB_ICONSTOP,'Report Error')
>>>	ELSE
>>>		.SetReportParameter('vp_ccase_cid', lcCID)
>>>****************************
>>>** From Dan Jurden
>>>** get a reference to the sections collection of the main report
>>>*loSections = loReport.Sections
>>>loSections = oRe.oreport.Sections
>>>** Go through each section in the main report...
>>>FOR EACH loSection IN loSections
>>>   ** Get all the objects in this section...
>>>   loReportObjects = loSection.ReportObjects
>>>   ** Go through each object in the reportobjects for this section...
>>>   FOR EACH loReportObject IN loReportObjects
>>>      ** Find the object which is the SubreportObject
>>>      IF loReportObject.Kind = 5 && crSubreportObject
>>>         ** Found a subreport, now get a hold of it
>>>         loSubReportObj = loReportObject
>>>         ** Open the subreport and treat it as any other report
>>>         loSubReport = loSubReportObj.OpenSubreport
>>>         **************************************************
>>>         ** set the parameter in the sub-report here     **
>>> 	     loSubReport.SetReportParameter('vp_ccase_cid', lcCID)
>>>         **************************************************
>>>      ENDIF
>>>   NEXT
>>>NEXT
>>>**************************************************
>>>		.Preview()
>>>	ENDIF
>>>ENDWITH
>>>
>>>
>>>>Do something like this:
>>>>
>>>>

>>>>** get a reference to the sections collection of the main report
>>>>loSections = loReport.Sections
>>>>
>>>>** Go through each section in the main report...
>>>>FOR EACH loSection IN loSections
>>>> ** Get all the objects in this section...
>>>> loReportObjects = loSection.ReportObjects
>>>>
>>>> ** Go through each object in the reportobjects for this section...
>>>> FOR EACH loReportObject IN loReportObjects
>>>> ** Find the object which is the SubreportObject
>>>> IF loReportObject.Kind = 5 && crSubreportObject
>>>> ** Found a subreport, now get a hold of it
>>>> loSubReportObj = loReportObject
>>>> ** Open the subreport and treat it as any other report
>>>> loSubReport = loSubReportObj.OpenSubreport
>>>>
>>>> **************************************************
>>>> ** set the parameter in the sub-report here **
>>>> **************************************************
>>>>
>>>> ENDIF
>>>>
>>>> NEXT
>>>>
>>>>NEXT
Thanks,
Dan Jurden
djurden@outlook.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform