PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Sonia Cruz on April 22, 2021, 12:44:01 AM

Title: Call "*rpt/runreport;Run_Call"
Post by: Sonia Cruz on April 22, 2021, 12:44:01 AM
Hello All,

Is there a way to change by programming the source data file set in the Report Writer before run and generate the reports through the following call program ? 

CALL "*rpt/runreport;Run_Call",RPTFILE$,TMP_HTML_NAME$

Any idea will be appreciated. 

Thanks in Advance!

Regards,

Sonia Cruz
Title: Re: Call "*rpt/runreport;Run_Call"
Post by: Mike King on May 07, 2021, 04:50:46 PM
Sonja

Yes -- You can open the report object, tell it the report file, open a print channel and pass that to the object, then run the report.  Something like this where ReportPath$ is the pathname to the pvr file:

Code: [Select]
  objReport=new("*rpt/pvxReport" for program)
 !
  if objReport'open(ReportPath$)=0 \
   then msgbox "Could not open report file:"+sep+sep+msg(err)+sep+msg(-1),"Initialization error","!";
        exit 12
 !
  open (hfn)"*pdf*;view;ORIENTATION=landscape"
  print_fl=lfo
 !
  objReport'OutputPrint(print_fl)
 !
  objReport'runReport()
  objReport'close()
 !
  drop object objReport,err=*next
  objReport=0
 !
  close (print_fl,err=*next)