oktoberfest2 Posted September 2, 2007 Posted September 2, 2007 It appears that auto it has some problems passing in a date value to a crystal reports parameter. I'm wondering if someone has found a way around this. Here is what I have: Thank you expandcollapse popupDim $i Dim $sReportName Dim $CRApp Dim $CrystalReport Dim $CRViewer1 ;Set Location of Template to Open $sReportName = "C:\Report1.rpt" ;Create Application Object instance $CRApp = ObjCreate("CrystalRuntime.Application") If $CRApp = 0 Then MsgBox(0, "Error", "Could not create CrystalRuntime Object") Exit EndIf ;Create a Report Object instance $CrystalReport = $CRApp.OpenReport($sReportName) ;Set Login Information _SetDataSource() If $CrystalReport = 0 Then MsgBox(0, "Error", "Could not open report: " & $sReportName) Exit EndIf ;Create a Report Viewer Object instance $CRViewer1 = ObjCreate("CrystalReports11.ActiveXReportViewer.1") ;################################################# ;Pass in some parameters ;################################################# ;This works fine (Passing in a String) $CrystalReport.ParameterFields(1).AddCurrentValue ("Passing in a String") ;This too works fine (Passing in a Number) $CrystalReport.ParameterFields(2).AddCurrentValue (100) ;or even this $CrystalReport.ParameterFields(2).AddCurrentValue (number("100")) ;Can't get this part to work (Passing in a Date) $CrystalReport.ParameterFields(3).AddCurrentValue ("2007-09-01") ;Even grabbing the first defaultvalue from Crystal does not work $CrystalReport.ParameterFields(3).AddCurrentValue ($CrystalReport.ParameterFields(3).getnthdefaultvalue(1))
Freedom1 Posted December 9, 2007 Posted December 9, 2007 Well, I hope an answer appears soon. I've been wanting to do an AutoIt to CR interface for some time now. I thought about locating a VB dll that would convert a string to date that could be used within AutoIt. But then again, if someone were knowlegeable on how dates were stored in VB, they could probably create a small conversion routine in AutoIt. Please share your findings with this forum, Freedom1
ptrex Posted December 10, 2007 Posted December 10, 2007 @All You guess are working with CR XI as I can see. I can't test this code because I am working with 8.5 unfortunately. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Freedom1 Posted December 31, 2007 Posted December 31, 2007 @AllYou guess are working with CR XI as I can see.I can't test this code because I am working with 8.5 unfortunately.regardsptrexPtrex,I'm using CR X and have the same problem. Unfortunately 99% of my reports use date parameters.Is there any type of testing or info I can provide to you to help us out of our dilemma short of sending you a copy of CR X? Is there a demo version of CR XI available?Hopefully someone can resolve this issue. AutoIt is GREAT!!!Freedom1
ptrex Posted January 1, 2008 Posted January 1, 2008 @Freedom1 I think the fastest way to get this resolved is to find a Vbscript that uses a date parameter example. And translate this script to au3. When you run it post the error here and the script here. Also a good way is searching the CR forum for examples. The error can be in the AU3 but also in the way the CR accepts the date syntax. Hard to tell like this. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
freeheart Posted July 4, 2008 Posted July 4, 2008 I got the same problem. Is anyone can help us please?
TheFrenZ Posted August 24, 2008 Posted August 24, 2008 Try passing a string containing the CR date formula i.e. "Date(2008,08,21)" I use this when passing parameters from PHP to a CR 8 website, it works fine in that situation.
dmorand Posted September 19, 2008 Posted September 19, 2008 Were any of you able to open a crystal report and have it print automatically? I'm trying to create a script to have a crystal report print or export automatically. Have any of you figured out how to pass the params??
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now