Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run code in report form
Message
 
 
To
12/01/2009 12:34:24
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01372806
Message ID:
01372888
Views:
18
>>>No, I meant that if run the UDF from the report title, will I have access then to the cursor I created there? And if I also returned a variable from the UDF, would the report have access to that? Do I need to somehow return the cursor as well? Will it be out of scope once I get back to the report from the UDF?
>>
>>
>>Yes. Yes. No. No.
>
>I'm getting an error that lnColumnCount is not found in the report during runtime. It is referenced in the Print When of objects in the groupings, and the groupings themselves are based on the value of the lnColumnCount variable.
>
>I have this in my report:
>
>"Report Title" + CreateReportCursor(ALIAS())
>
>And this is the procedure:
>
>****************************************************************************************************
>* JJ - For generic reporting, currently for maintenance Lookup tables.
>****************************************************************************************************
>* Call: m.TempVariable = 'My Report Title' + CreateReportCursor(ALIAS())
>PROCEDURE CreateReportCursor( m.AliasToConvert )
>	IF !EMPTY(m.AliasToConvert)
>		LOCAL ;
>			lcTable, ;
>			lcFields
>		lcTable = ALLTRIM(UPPER(JUSTSTEM(m.AliasToConvert)))
>		lcFields = ''
>		lnColumnCount = FCOUNT(m.AliasToConvert )
>		FOR ix =1 TO lnColumnCount
>			lcFields = m.lcFields + IIF(m.ix > 1, ', ','') + FIELD(ix) + ' AS Fld'+TRANSFORM(ix)
>		ENDFOR
>		RunSQL = 'SELECT ' + lcFields + ' FROM ' + m.AliasToConvert + ' INTO CURSOR ReportCursor'
>		&RunSQL
>	ENDIF
>	RETURN ''
>****************************************************************************************************
>
I would do this instead in Report's DE Init method.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform