note 75914 added to class.com

From: Date: Thu, 21 Jun 2007 12:03:17 +0000
Subject: note 75914 added to class.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-127857@lists.php.net to get a copy of this message
Thanks to paul at completewebservices who added a note earlier; I have used his code to solve a particularly difficult issue with the Crystal 9 runtime component. For some reason, VBA/VBS can pass a native Date type as a parameter to a Crystal Report requiring a date, but in PHP I've tried all manner of strings, unix timestamps, COM variant dates etc and all of these resulted in a com_exception. My solution was to employ VBScript to borrow the CDate function, which works correctly. Not the most elegant of solutions, but this parameterised approach is to be preferred to search-n-replacing the RecordSelectionFormula string. Of course if anyone here has an even better approach, do post it here - I am sure it would be of use. <?php // $rptParam is a report parameter object having a type of date $oScript = new COM("MSScriptControl.ScriptControl"); $oScript->Language = "VBScript"; $oScript->AllowUI = false; $oScript->AddObject('rptParam', $rptParam, true); $oScript->AddCode('Function SetDateParameter(strDate) rptParam.AddCurrentValue(CDate(strDate)) End Function'); $oScript->Run("SetDateParameter", "25 April 2006"); ?> ---- Server IP: 87.124.64.96 Probable Submitter: 212.140.133.126 ---- Manual Page -- http://www.php.net/manual/en/class.com.php Edit -- https://master.php.net/note/edit/75914 Del: integrated -- https://master.php.net/note/delete/75914/integrated Del: useless -- https://master.php.net/note/delete/75914/useless Del: bad code -- https://master.php.net/note/delete/75914/bad+code Del: spam -- https://master.php.net/note/delete/75914/spam Del: non-english -- https://master.php.net/note/delete/75914/non-english Del: in docs -- https://master.php.net/note/delete/75914/in+docs Del: other reasons-- https://master.php.net/note/delete/75914 Reject -- https://master.php.net/note/reject/75914 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127857) next »