mortenm
12/9/2005 12:00:00 PM
Hi arno,
We have a solution much like the one you describe.
The reports are called with a parameter that tells them to make pdf-files.
The parameter inculde a filename and selections:
#AUTOPDF#\\server\dir\filename#10001#
In the init method in the report we have made some changes:
parm = args.parm();
parm = strreplace(parm, "#", "\n");
if (strline(parm, 1) == "AUTOPDF")
{
autoPdf = true;
filePdf = strline(parm, 2);
vendAccount = strline(parm, 3);
}
super();
if (autoPdf == true)
{
element.suppressReportIsEmptyMessage(true);
printJobSettings = element.printJobSettings();
printJobSettings.setTarget( PrintMedium::File);
printJobSettings.format( PrintFormat::PDF);
printJobSettings.fileName( filePdf);
printJobSettings.warnIfFileExists( false);
printJobSettings.suppressScalingMessage(true);
}
if (vendAccount != "")
{
q = this.query();
qbds = q.dataSourceTable(tablenum(VendTable));
qbr = qbds.findRange(fieldnum(VendTable, VendAccount));
if (!qbr)
{
qbr = qbds.addRange(fieldnum(VendTable, VendAccount));
}
qbr.value(queryvalue(vendAccount));
}
The fetch method is also overridden:
public boolean fetch()
{
;
queryRun = new QueryRun(this);
if (autoPdf == false)
{
if (queryRun.prompt() == false)
{
return false;
}
if (element.prompt() == false)
{
return false;
}
}
while (queryRun.next())
{
VendTable = queryRun.get(tablenum(VendTable));
element.send(VendTable);
}
return true;
}
We have a class with a static method that is called from the
web-application. Part of the code is:
args = new Args(reportstr(YourReportName));
args.parm("#AUTOPDF#\\server\\dir\filename#10001#");
reportRun = new ReportRun(args);
reportRun.init();
reportRun.run();
The file is read into the web-application and displayed there.
Good luck!
Regards,
Morten Mile
"arno" wrote:
> Hi,
>
> We've got a customer web site which will make use of the business connector
> to connect Axapta.
> The customer web site will be developed in .NET.
>
> I need to generate 'on the fly' a PDF from an existing report.
>
> What are the possible solutions ?
>
> - generate PDF from a report ?
> - use an API to generate it from tables ?
>
> ...
>
> Thanks !
>
>
>