note 79781 added to ref.com
| From: | Bandorka at osu1 dot php dot net | Date: | Wed, 12 Dec 2007 16:52:33 +0000 |
| Subject: | note 79781 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133393@lists.php.net to get a copy of this message | ||
Guys, I found a way to pass parameters from PHP to Crystal Reports 11 without hanging!!!!
So the problem is the prompt for params dialog:
$ObjectFactory= New COM("CrystalReports11.ObjectFactory.1");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->Database->Tables->
Item(1)->ConnectionProperties['User ID'] = 'blablabla';
$creport->Database->Tables->
Item(1)->ConnectionProperties['Password'] = 'blablabla';
$creport->FormulaSyntax = 0;
$creport->RecordSelectionFormula= "{TABLENAME.FIELDNAME}='$USRID'";
//This is it, this avoids the hanging!
$creport->EnableParameterPrompting = 0;
$creport->DiscardSavedData;
$creport->ReadRecords();
//it is essential to assign the param values here after the readrecords otherwise you will not pass
anything...
$zz= $creport->ParameterFields(1)->SetCurrentValue(500);
$creport->ExportOptions->DiskFileName=$exp_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; $creport->ExportOptions->FormatType=31;
$creport->Export(false);
$creport->ExportOptions->DiskFileName=$exp_xls;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; $creport->ExportOptions->FormatType=29;
$creport->Export(false);
$len = filesize($exp_pdf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=reportin.pdf");
readfile("reportin.pdf");
//------ Release the variables
$creport = null;
$crapp = null;
$ObjectFactory = null;
Have fun,
Andras
----
Server IP: 64.71.164.2
Probable Submitter: 89.132.152.121
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- https://master.php.net/note/edit/79781
Del: integrated -- https://master.php.net/note/delete/79781/integrated
Del: useless -- https://master.php.net/note/delete/79781/useless
Del: bad code -- https://master.php.net/note/delete/79781/bad+code
Del: spam -- https://master.php.net/note/delete/79781/spam
Del: non-english -- https://master.php.net/note/delete/79781/non-english
Del: in docs -- https://master.php.net/note/delete/79781/in+docs
Del: other reasons-- https://master.php.net/note/delete/79781
Reject -- https://master.php.net/note/reject/79781
Search -- https://master.php.net/manage/user-notes.php