Q re returning information from a report to a calling form 
Author Message
 Q re returning information from a report to a calling form

Please help with the following problem. I use a form to generate a
varying number of reports of varying sizes. I also generate a fax
cover from this form. I need some way to return the number of pages
from each report as it is generated to add to a counter for the
"Number of Pages" field in the fax cover.

Here is a stripped down version of the relevant part of code. Some
variables aren't defined here, but they are when it runs.
------
method pushButton(var eventInfo Event)

var
        rep                     report
        repInfo         ReportPrintInfo
        strCmd          string
endVar

if fldFax then
        if not printerSetCurrent("WINFAX,WINFAX,COM1:") then
                msgInfo("Tarnations!", "Couldn' change printer driver to: " +
strPtr)
        endIf
        repInfo.masterTable = strGrp + string(int(ecoutID)) + ".DB"
        repInfo.name = strGrp + ".RSL"
   strCmd = "{delay 8000}%v{delay 0}" + StrGrp +
string(int(ecoutID))  + "~~"
   sendkeys(strCmd, false)
; somewhere in here I want to return the number of pages, as in
; numPages = rep.NofPagesField, which doesn't work
        rep.print(repInfo)
endIf

endMethod
------

Thanks for your assistance.

Paul Klassen



Sat, 16 Oct 1999 03:00:00 GMT
 Q re returning information from a report to a calling form

Quote:

> Please help with the following problem. I use a form to generate a
> varying number of reports of varying sizes. I also generate a fax
> cover from this form. I need some way to return the number of pages
> from each report as it is generated to add to a counter for the
> "Number of Pages" field in the fax cover.

> Here is a stripped down version of the relevant part of code. Some
> variables aren't defined here, but they are when it runs.
> ------
> method pushButton(var eventInfo Event)

> var
>         rep                     report
>         repInfo         ReportPrintInfo
>         strCmd          string
> endVar

> if fldFax then
>         if not printerSetCurrent("WINFAX,WINFAX,COM1:") then
>                 msgInfo("Tarnations!", "Couldn' change printer driver to: " +
> strPtr)
>         endIf
>         repInfo.masterTable = strGrp + string(int(ecoutID)) + ".DB"
>         repInfo.name = strGrp + ".RSL"
>    strCmd = "{delay 8000}%v{delay 0}" + StrGrp +
> string(int(ecoutID))  + "~~"
>    sendkeys(strCmd, false)
> ; somewhere in here I want to return the number of pages, as in
> ; numPages = rep.NofPagesField, which doesn't work
>         rep.print(repInfo)
> endIf

> endMethod
> ------

> Thanks for your assistance.

> Paul Klassen

I haven't tried this myself so this is just a guess, there may also be
an easier way.

I assume the number of pages field is on the report.
Try:

if Rep.open(RepInfo, winstyleHidden) then
        NPages = Rep.NameOfNumberOfPagesField
        Rep.close()
        Rep.print(RepInfo)
endif

With the Number of pages field on the report it should run all the way
to the end of the report when it first opens in order to get that info
on the first page. Unfortunately it may also make the NPages assignment
before it gets to the end of the report.  I'm counting on Paradox's
inability to do 2 things at once to make this work.  I'm guessing that
it will run to the end of the report before it executes the assignment
line.

I could probably insure the assignment will take place by putting a
Rep.wait() before the assignment line but that would mean opening the
report without the winstyleHidden and closing it manually, which may be
undesirable.

I don't think calling the "Print" the way I did was the best way either
because then you have to wait for the report to reach the end twice, but
as I said, I've never tried this.

Give it a try, what more can you waste but your time?

Al Solter



Sat, 16 Oct 1999 03:00:00 GMT
 Q re returning information from a report to a calling form

On Tue, 29 Apr 1997 23:27:54 -0400, Al Solter

Quote:


>> Please help with the following problem. I use a form to generate a
>> varying number of reports of varying sizes. I also generate a fax
>> cover from this form. I need some way to return the number of pages
>> from each report as it is generated to add to a counter for the
>> "Number of Pages" field in the fax cover.

>> Here is a stripped down version of the relevant part of code. Some
>> variables aren't defined here, but they are when it runs.
>> ------
>> method pushButton(var eventInfo Event)

>> var
>>         rep                     report
>>         repInfo         ReportPrintInfo
>>         strCmd          string
>> endVar

>> if fldFax then
>>         if not printerSetCurrent("WINFAX,WINFAX,COM1:") then
>>                 msgInfo("Tarnations!", "Couldn' change printer driver to: " +
>> strPtr)
>>         endIf
>>         repInfo.masterTable = strGrp + string(int(ecoutID)) + ".DB"
>>         repInfo.name = strGrp + ".RSL"
>>    strCmd = "{delay 8000}%v{delay 0}" + StrGrp +
>> string(int(ecoutID))  + "~~"
>>    sendkeys(strCmd, false)
>> ; somewhere in here I want to return the number of pages, as in
>> ; numPages = rep.NofPagesField, which doesn't work
>>         rep.print(repInfo)
>> endIf

>> endMethod
>> ------

>> Thanks for your assistance.

>> Paul Klassen

>I haven't tried this myself so this is just a guess, there may also be
>an easier way.

>I assume the number of pages field is on the report.
>Try:

>if Rep.open(RepInfo, winstyleHidden) then
>    NPages = Rep.NameOfNumberOfPagesField
>    Rep.close()
>    Rep.print(RepInfo)
>endif

>With the Number of pages field on the report it should run all the way
>to the end of the report when it first opens in order to get that info
>on the first page. Unfortunately it may also make the NPages assignment
>before it gets to the end of the report.  I'm counting on Paradox's
>inability to do 2 things at once to make this work.  I'm guessing that
>it will run to the end of the report before it executes the assignment
>line.

>I could probably insure the assignment will take place by putting a
>Rep.wait() before the assignment line but that would mean opening the
>report without the winstyleHidden and closing it manually, which may be
>undesirable.

>I don't think calling the "Print" the way I did was the best way either
>because then you have to wait for the report to reach the end twice, but
>as I said, I've never tried this.

>Give it a try, what more can you waste but your time?

>Al Solter

Well, thanks again for the help. Unfortunately, this time it didn't
work. In a nutshell, any time I use the formulation:
var = rep.NameOfSomeFieldOnTheReport
I get an error message to the effect that NameOfSomeFieldOnTheReport
doesn't exist or is not visible to the calling method. i.e. the rep.
prefix seems to have no effect, and Paradox expects to find the
field on the current form.

Here is some code that yields the desired results:

method pushButton(var eventInfo Event)

var
        rep                     report
   done                 logical
   nPage                        number
endVar

if not rep.open("R1.RSL", WinStyleHidden) then
   return
endIf

done = false
while not done
        nPage = rep.currentPage()
        rep.moveToPage(nPage + 1)
        if nPage = rep.currentPage() then
                done = true
        else
                nPage = nPage + 1
        endIf
endWhile
nPage.view()

rep.close()

endMethod

Code doesn't get more inelegent than this, and I'd appreciate any
suggestions as to better ways to accomplish the job.

Thanx,

Paul



Sun, 17 Oct 1999 03:00:00 GMT
 Q re returning information from a report to a calling form



Quote:

>Please help with the following problem. I use a form to generate a
>varying number of reports of varying sizes. I also generate a fax
>cover from this form. I need some way to return the number of pages
>from each report as it is generated to add to a counter for the
>"Number of Pages" field in the fax cover.

>Here is a stripped down version of the relevant part of code. Some
>variables aren't defined here, but they are when it runs.
>------
>method pushButton(var eventInfo Event)

>var
>    rep                     report
>    repInfo         ReportPrintInfo
>    strCmd          string
>endVar

>if fldFax then
>    if not printerSetCurrent("WINFAX,WINFAX,COM1:") then
>            msgInfo("Tarnations!", "Couldn' change printer driver to: " +
>strPtr)
>    endIf
>    repInfo.masterTable = strGrp + string(int(ecoutID)) + ".DB"
>    repInfo.name = strGrp + ".RSL"
>   strCmd = "{delay 8000}%v{delay 0}" + StrGrp +
>string(int(ecoutID))  + "~~"
>   sendkeys(strCmd, false)
>; somewhere in here I want to return the number of pages, as in
>; numPages = rep.NofPagesField, which doesn't work

I can't help with the sendkeys bit & the other stuff you are doing.
But I remember px4.5 using repInfo or reportOpenInfo to something like
 (  pseudocode )

     foundlast = false
    while not foundlast
         pno = r.PageNo()
         r.NextPage()    ; next record ?
         sleep(300)
         if pno = r.Pageno() then
                foundlast = true
         endif
    endwhile

There is also probably a more elegant way to do it by
      r.nextpage() and
 checking errorcode()

HTH

Ian

- Show quoted text -

Quote:
>    rep.print(repInfo)
>endIf

>endMethod
>------

>Thanks for your assistance.

>Paul Klassen



Mon, 18 Oct 1999 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Calling a form from a form called by a form problem [PDOXWIN 1.0]

2. Help: Retaining Report Page Layout When Calling Report From Form

3. REPORT : INFORMATION FROM A FORM ?

4. Report:rescue information from a form

5. returning to calling form

6. Foxprod Dos 2.6 Report writer Qs.

7. A report called from a form

8. calling reports from forms

9. Calling Reports from Forms -- Errors

10. Poor performance in Report 2.5 (called by Runproduct Forms 4.5)

11. Problem with calling Reports from forms on FORMS4.5 (CHAR MODE)

12. could not call report from form


 
Powered by phpBB® Forum Software