note 63535 deleted from ref.com by danbrown

From: Date: Mon, 21 Dec 2009 17:06:35 +0000
Subject: note 63535 deleted from ref.com by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164200@lists.php.net to get a copy of this message
Note Submitter: djogopatrao at gmail dot com ---- Since my last post, I struggled hard to find a way to pass parameters to Crystal. Luckly, all I needed was to restrict results from a query, so I found this simple solution: // by dfcp/mar/06 $ObjectFactory= New COM("CrystalReports11.ObjectFactory.1"); $crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application"); $creport = $crapp->OpenReport($my_report, 1); $creport->FormulaSyntax = 0; $creport->RecordSelectionFormula = "{cadastro.id}>10 and {cadastro.id}<20"; notice that RecordSelectionFormula must be in Crystal Syntax, and the FormulaSyntax=0 makes it work 100% of the time (I suspect that it's bug, although they1 don't seem to think so). If you need to pass parameters to, say, multiply some field by, IMHO the right way is to use ParameterFields, but the code above hangs on the last line: $z = $creport->ParameterFieldDefinitions->Item(1); //gets the first parameter $z->SetCurrentValue( "teste" ); // hangs here I saw this at some ASPX foruns... no idea why it doesn't work here on PHP... feedback would be highly appreciated. [1] http://support.businessobjects.com/library/kbase/articles/c2018734.asp

« previous php.notes (#164200) next »