php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36959 ReadRecords Method (Crystal Reports XI) Hangs
Submitted: 2006-04-03 14:10 UTC Modified: 2008-11-27 13:21 UTC
Votes:18
Avg. Score:4.4 ± 0.9
Reproduced:11 of 12 (91.7%)
Same Version:10 (90.9%)
Same OS:8 (72.7%)
From: djogopatrao at gmail dot com Assigned:
Status: Not a bug Package: COM related
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID: None
 [2006-04-03 14:10 UTC] djogopatrao at gmail dot com
Description:
------------
In order to verify this, you need 

1) crystal reports XI version 2 (free download for trial at www.businessobjects.com)

2) access to a database

3) a report that uses data from this database

the code above hangs when invoking the ReadRecords method. A equivalent code was tested and worked OK under Visual Fox Pro.

thanks

dfcp



Reproduce code:
---------------
$my_report = "c:\\report1.rpt";
$my_pdf = "c:\\report1.pdf";

$ObjectFactory= New COM("CrystalReports115.ObjectFactory.1");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->ReadRecords(); //hangs here
$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF
$creport->Export(false);

Expected result:
----------------
It would create a file (name $my_pdf) with the report. 

Actual result:
--------------
It hangs.

Patches

CrystalReport_php_support (last revision 2013-10-18 10:13 UTC by yr dot bhavsar at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-03 14:23 UTC] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Please define "hangs" and add more information if possible.
 [2006-04-03 14:33 UTC] djogopatrao at gmail dot com
When I say that it hangs, I mean that the browser keeps on loading the page forever, until it gets timeout.

More information? I would gladly give an example report file, but as it depends on a database server and ODBC configuration, I don't know how to proceed.

Please contact me if is there anything that I can do.

dfcp
 [2006-04-03 14:49 UTC] tony2001@php.net
Error log entries related to the problem would be more helpful than just "hangs".
Also, you can try to run the same code with PHP CLI and check for any error messages.
 [2006-04-03 15:41 UTC] djogopatrao at gmail dot com
I modified slightly the code (see below, I called it hang.php)

Running thru apache2, it hangs. No response from the browser  (it's still "loading", started 2h ago). No entries in "error.log" since then. Commenting the $creport->ReadRecords(); line, it works.


But when running by PHP CLI

C:\>"Arquivos de programas\Apache Group\Apache2\bin\php.exe" hang.php

C:\>


It runs just fine!


--------- hang.php

$my_report = 'C:\Arquivos de programas\Apache Group\Apache2\htdocs\webdisc\relatorios\cadastro1.rpt';
$my_pdf = 'c:\18530.pdf';

$ObjectFactory= New COM("CrystalReports115.ObjectFactory.1");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->ReadRecords(); //hangs here, not thru PHPCLI
$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF
$creport->Export(false);
 [2006-05-22 15:34 UTC] i_geber at hotmail dot com
If I would like to call a report that has parameters, how do I write the syntax?

thanks
 [2007-08-15 08:37 UTC] jani@php.net
Assigned to the maintainer.
 [2008-06-06 12:53 UTC] rquadling@php.net
Most likely this is not a bug. I've just started using Crystal XI with PHP5. One of the things that happens for me is I get a dialogue asking to login to the DB being used by the report.

See http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_23463121.html#21728474


 [2008-11-27 11:06 UTC] hummerok at gmsil dot com
this is not a bug. probably you have some alerts when you open this 
report in designer. all you need - just to update it and thos alert 
will gone. another reason: when you set parameters from your program 
you need to set $creport->EnableParameterPrompting = 0; - this also 
might help. I had problems like this - solved
 [2008-11-27 11:22 UTC] pajoye@php.net
not a bug  > bogus
 [2008-11-27 13:21 UTC] djogopatrao at gmail dot com
Hello

Please refer to my previous comment at 3 Apr 2006, in which I tested the same code with PHP-CLI and it worked fine, but without any pop-ups. When generating the report from CR, no pop-ups appeared too. That particular rpt file had all the connection information.

I also remember that it wasn't related to some connection problem - if the settings were incorrect, it would throw a exception instead of hanging.

It was 2 years ago, and I don't know anymore where the bug setup files are, but if you wish I can spend some time looking for it.
 [2010-03-12 08:49 UTC] girlmauhong85 at yahoo dot com
i work with Crystal Report 10 and i work only onnce time. When i try again, i get the following error:Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Crystal Reports ActiveX Designer<br/><b>Description:</b> Unbekannter Abfragemodulfehler' in C:\xampp\htdocs\neu\BescheinigungPDF.php:28 Stack trace: #0 C:\xampp\htdocs\neu\BescheinigungPDF.php(28): variant->LogOnServer('p2sifmx', 'name', 'name', 'acc', 'pass') #1 C:\xampp\htdocs\neu\BescheinigungPDF.php(123): BescheinigungPDF->getPDF('20062', 99898989) #2 {main} thrown in C:\xampp\htdocs\neu\BescheinigungPDF.php on line 28

my code:
function getPDF($sem,$mtknr){
        // Create an Crystal Object Factory.    
        $o_CrObjectFactory = new COM('CrystalReports10.ObjectFactory.1')or die ("Error on load");
        try {
            $o_CrApplication = $o_CrObjectFactory->CreateObject("CrystalRunTime.Application");
        } catch (com_exception $e){
            echo("<br>Error on instance creation:<br>".$e->getMessage().'<p>'.$e->getTraceAsString().'</p>');
            echo "<p><pre>".print_r($e, true)."</pre></p>";
            exit;
        }
        // Register the typelibrary.
        com_load_typelib('CrystalDesignRunTime.Application');
        // Load the report.
        $o_CrReport = $o_CrApplication->OpenReport('C:\xampp\apache\Studienbescheinigung.rpt', 1);// 1== crOpenReportByTempCopy.
        $o_CrReport->Database->LogOnServer('p2sifmx', 'name', 'name', 'acc', 'pass');
        $o_CrReport->DisplayProgressDialog = False;
        $s_ExportedReport = 'C:\xampp\apache\test.pdf';
        var_dump($o_CrReport->RecordSelectionFormula);
        $str = "{sossys.aktsem} = $sem and {sos.mtknr} = $mtknr";
        $o_CrReport->RecordSelectionFormula=$str;
        var_dump($o_CrReport->RecordSelectionFormula);
        // Run the report and save the PDF to disk.
        $o_CrReport->ExportOptions->DiskFileName = $s_ExportedReport;
        $o_CrReport->ExportOptions->PDFExportAllPages = true;
        $o_CrReport->ExportOptions->DestinationType = 1; // Export to File
        $o_CrReport->ExportOptions->FormatType = 31; // 31 = PDF, 36 = XLS, 14 =DOC
        $o_CrReport->EnableParameterPrompting = 0;
        $o_CrReport->DiscardSavedData;  //remove die saved Datei
        $o_CrReport->ReadRecords(); //force it to update the data in the report from the ADO.command,(Does not work).
        $o_CrReport->Export(false);

        $o_CrReport=null;
        $o_CrApplication = null;
        $o_CrObjectFactory=null;
        
        print "...done";
        var_dump($o_CrReport->RecordSelectionFormula);  /*****/
       
    
        }


My chef think, i shoul programm in java but every thing i worked with php(my programm work for an card terminal). Should i make an connection between php and java to call my crystal report?
Please help me, thank you very much!!!
 [2014-07-08 11:44 UTC] syerif at gmail dot com
I have problem with set parameterFields SetCurrentValue in date format anybody can help me?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC