Fast Reports using XRun

Quick Guide >>

Xrun is a function provided in Axpert which can be used to execute any Windows application through a user defined action. You can invoke FastReports using this function using the method described below.

In TStruct:

Write a user defined action as follows and assign the action to any button or label.

xrun({Axfast%project=” “,report=” “,mode=” “,output=” “,showfile=” “})

Parameters for the above action should be in the following format,

project=”demo”, report=”pay slip”, mode=”run/define”, output=”pdf/html/xml/preview”,outfile=”payslipreport”,showfile=”true/false”, pdf_password=”hello”,param1=”}+param1+{“,etc.

In IViews :

Create a table Axprint in the backend using the following definition,

CREATE TABLE AXPRINT
(
OUTPATH VARCHAR2(300),
OUTFILE VARCHAR2(300),
RMODE VARCHAR2(10),
REPORT VARCHAR2(100),
OUTPUT VARCHAR2(5),
NAME VARCHAR2(50),
STATUS NUMBER(1),
ERRORMESSAGE VARCHAR2(250),
[PARAM1,PARAM2,…]
)

Column Name Description Eg.
Outpath Output Path of the file D:\payslips
Outfile Output file name. EMP01_Payslip (without extension)
Rmode Mode could be Define/Run run
Report The Fast Report Name Payslip (without extension )
Output File type. It could be any one of the preferred extension. (pdf/html/xml) Pdf
Status Values for status will be 0 or 1 or -1The Axfast will read the each row from the IView only if the status is ’0’.Once the action is completed the status will be set as ‘1’.
If there any error the status value will be automatically set as ‘-1’ & the error will be entered in the ErrorMessage field.
Parameters column (if any) If any parameters are used in the report,a column should be added for every parameter in the report.

Write a user defined action using the syntax for hybrid action :

@start

firesql({f1},{delete from Axprint})

@row

firesql({f2},{insert into Axprint (outpath,outfile,rmode,report,output,param1) values (:outpath,:outfile,:rmode,:report,:output,:param1)})

@end

xrun({Axfast%project=”xyz”,source=”Axprint”})

Set the Event for the action as All selected rows , save the action and and assign the action to any button or label .

E-mailing Fast Reports using XRun :

To Email Fast Reports using XRun, the syntax is as follows :

xrun({Axfast%project=”projectname”,report=”reportname”,mode=”run”,output=”emailpdf”,host=””,port=”portnumber”,login=” “,password=” “, <?from>”}+frommail+{“</from>,<?mailto>”}+mailto+{“</mailto>,<?sub>”}+subject+{“</sub>,<?tbody>”}+body+{“</tbody>})

Note: The order & syntax of the parameters should not be changed . All the parameters are mandatory.