note 63535 added to ref.com
| From: | djogopatrao at gmail dot com | Date: | Thu, 23 Mar 2006 06:44:33 +0000 |
| Subject: | note 63535 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106454@lists.php.net to get a copy of this message | ||
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
----
Server IP: 66.163.161.117
Probable Submitter: 201.52.35.45
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- http://master.php.net/note/edit/63535
Del: integrated -- http://master.php.net/note/delete/63535/integrated
Del: useless -- http://master.php.net/note/delete/63535/useless
Del: bad code -- http://master.php.net/note/delete/63535/bad+code
Del: spam -- http://master.php.net/note/delete/63535/spam
Del: non-english -- http://master.php.net/note/delete/63535/non-english
Del: in docs -- http://master.php.net/note/delete/63535/in+docs
Del: other reasons-- http://master.php.net/note/delete/63535
Reject -- http://master.php.net/note/reject/63535
Search -- http://master.php.net/manage/user-notes.php