Dear all
I am having substantial trouble passing a date parameter to the Crystal Reports 9 component from PHP5 on Windows. It should be easy, of course, but the various commented-out items don't seem to work:
Any thoughts as to what I might be doing wrong? It results on every occasion in these errors:Code:$rptParam = $rptParams->Item(2); $t = $rptParam->ValueType; // This comes out to 10, which is correct for a Crystal date type //None of these work //$rptParam->SetCurrentValue("25/04/2007"); //$rptParam->SetCurrentValue("25-04-2007"); //$rptParam->SetCurrentValue("25 April 2007"); //$rptParam->SetCurrentValue("#25/04/2007#"); //$rptParam->SetCurrentValue('20070425'); //$rptParam->SetCurrentValue("25/04/2007 00:00"); //$rptParam->SetCurrentValue("00:00 25/04/2007"); //$rptParam->SetCurrentValue("00:00 25/04/2007"); //$rptParam->SetCurrentValue("25/Apr/2007"); //$rptParam->SetCurrentValue(date('c')); //$rptParam->SetCurrentValue(time()); // These don't work either //$v = new Variant(time(), VT_DATE); $v = variant_date_from_timestamp(time()); $rptParam->SetCurrentValue($v);
Incidentally I am not keen on using RecordSelectionFormula as this does not properly register parameters with the report. Meanwhile I have also seen that another approach (but dot net) is possible, but I wonder whether this might require CR 10+, as the ParameterDiscreteValue is not available AFAICT on v9.PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown Description: Unknown' in C:\dev-misc\crystal.php:57
Stack trace:
#0 C:\dev-misc\crystal.php(57): variant->SetCurrentValue(Object(variant))
#1 {main}
thrown in C:\dev-misc\crystal.php on line 57
Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown
Description: Unknown' in C:\dev-misc\crystal.php:57
Stack trace:
#0 C:\dev-misc\crystal.php(57): variant->SetCurrentValue(Object(variant))
#1 {main}
thrown in C:\dev-misc\crystal.php on line 57
Many thanks in advance for any pointers offered.




Bookmarks