Please tell me How I can pass parameters to report? 
Author Message
 Please tell me How I can pass parameters to report?

In response to the question:
Please tell me How I can pass parameters to report?

It was said:
A report has access to any variables that are in scope in
the method/procedure/function that called the report. You
can refer to memory variables (m.MyVariable), form
properties (frmMyForm.MyProperty) or object properties
(oMyObject.MyProperty).

It seems so simple but I must be doing something wrong.

The form that calls the report says:

m.prntstatus = "R"

REPORT FORM &zreportcl.obclp122a.frx NOEJECT NOCONSOLE TO
PRINTER

I then use m.prntstatus as a field on my report but the "R"
never shows up!

What do you mean by:
variables that are in scope in the
method/procedure/function

Do I have to define m.prntstatus as a variable in the
report?
Do I have to create m.prntstatus as a formset property on
the form?

Thanks for any help you can give me.

Roger



Mon, 29 Aug 2005 04:41:17 GMT  
 Please tell me How I can pass parameters to report?
Hi Roger,

One way to understand "in scope" is that you can see this variable in the
Locals window of the de{*filter*}. Please note that if your m.prntstatus = "R"
occurred in any form method other than the one where the REPORT command was
issued it will not be "in scope" _except_  if it is a Public (not the best
idea) or a property of the form, or an Application Object (often goApp).

My usual report code looks something like this:

*!* Click method of "Print Report" button
LOCAL lcFootnote
lcFootnote = "Data for FY 2003 Q1 only"

SELECT SomeData ;
    FROM GeneralLedger ;
    INTO CURSOR GLReportCursor

REPORT FORM GeneralLedger.frx TO PRINTER PROMPT PREVIEW

In the report control I have lcFootnote as the expression. m.Whatever is
good to use if there is a field name that is the same as your variable. If
you were to step through this code in the de{*filter*}Note that the lcFootnote
variable will show in the locals window when the REPORT statement is ready
to execute.

Reasons for fields not showing up - I've seen some not show because there
was a Print When condition that I'd forgotten about. I've seen some not show
when the field was not wide enough.

Try putting something like lcComment = "Put stuff here" (m.lcComment in
Report expression) in really big letters someplace obvious on your report as
a proof of concept. If you can get that one to work then there's a bug in
your m.prntstatus variable or it's representation on your report.

Now as to "report variables" they are defined within the report (from the
menu, Report | Variables...) and are usually used for making running totals
or other calculations that can't be done in a report expression. An example
is (SUM) IIF(Color = "Red", 1, 0) where you might want to include a total of
red things only when there are other colors present.

As for forms and formsets, I've never used formsets, but you can make a
variable be a property of your form and it should work with the report
expression frmMyForm.MyProperty. You can't use "ThisForm" but must refer to
the form by its name.

Please post back if you're still having trouble.

--
Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

http://www.*-*-*.com/ ; http://www.*-*-*.com/


Quote:
> In response to the question:
> Please tell me How I can pass parameters to report?

> It was said:
> A report has access to any variables that are in scope in
> the method/procedure/function that called the report. You
> can refer to memory variables (m.MyVariable), form
> properties (frmMyForm.MyProperty) or object properties
> (oMyObject.MyProperty).

> It seems so simple but I must be doing something wrong.

> The form that calls the report says:

> m.prntstatus = "R"

> REPORT FORM &zreportcl.obclp122a.frx NOEJECT NOCONSOLE TO
> PRINTER

> I then use m.prntstatus as a field on my report but the "R"
> never shows up!

> What do you mean by:
> variables that are in scope in the
> method/procedure/function

> Do I have to define m.prntstatus as a variable in the
> report?
> Do I have to create m.prntstatus as a formset property on
> the form?

> Thanks for any help you can give me.

> Roger



Mon, 29 Aug 2005 05:22:57 GMT  
 Please tell me How I can pass parameters to report?

This should do:


Quote:
> In response to the question:
> Please tell me How I can pass parameters to report?

> It was said:
> A report has access to any variables that are in scope in
> the method/procedure/function that called the report. You
> can refer to memory variables (m.MyVariable), form
> properties (frmMyForm.MyProperty) or object properties
> (oMyObject.MyProperty).

> It seems so simple but I must be doing something wrong.

> The form that calls the report says:

public m.pmstatus

Quote:
> m.prntstatus = "R"

report form report1 to printer prompt preview

release m.pmstatus

Quote:
> I then use m.prntstatus as a field on my report but the "R"
> never shows up!

> What do you mean by:
> variables that are in scope in the
> method/procedure/function

they are declared public before you call your report.

Quote:

> Do I have to define m.prntstatus as a variable in the
> report?

no, you don't

Quote:
> Do I have to create m.prntstatus as a formset property on
> the form?

again no
Quote:
> Thanks for any help you can give me.

> Roger



Mon, 29 Aug 2005 14:02:17 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How I can pass parameters in report?

2. Passing Parameters to Report

3. Passing parameters to a report

4. Passing parameters to report variables

5. passing parameters to a vfp report

6. how to pass parameter in REPORT FORM clause,urgent

7. Passing Parameters to Reports VP5

8. Can I pass parameters to a report?

9. Passing Parameters to Reports

10. Can variables (parameters) be passed to a report?

11. Could someone Please tell me what is wrong with this scope clause

12. Please tell me, Writing Application Guidlines

 

 
Powered by phpBB® Forum Software