Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you call a METHOD from a report to get a variable?
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Miscellaneous
Thread ID:
01191362
Message ID:
01191452
Views:
8
>>>>I am trying to get some specific calculations off of items sold in a POS system and print them on a report. Unfortunately, because these calculations vary greatly on several factors... it would be next to impossible to put them in the small EXPRESSION field in the report writer itself. In addition, trying to store them in temporary variables during the actual criteria step of the report call would be nearly impossible as well... to many factors control what needs to be calculated.
>>>>
>>>>I can write the actual calculations in a couple of code snippets and want to know if there is a way to call that coded routine from the actual report and have it return to the report the final calculation for printing.
>>>>
>>>>Thanks ahead of time.
>>>
>>>To expand Ed's solution. Put a textbox on the form with expression MyFunction(). Let your function to return empty string. Add remove if blank option to this textbox.
>>
>>And yet another option... if you are reporting from a cursor (writable) used to get the data, add an extra column to hold the final value and pre-call your method and store results even before the report is called... this way, its just another field in the report.
>
>Right, but AFAIK this requires double pass.

Not necessarily... if your first pass does a query with the method originally presented, its done up front to get the cursor in the first place, then the report just processes the result...

select a.*, UserFunction( a.fld1, a.fld2, etc ) as CalcResult from ...

then the report just shows the "CalcResult" column and has no need to make a call to the user function.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform