Jump to content

Recommended Posts

Posted

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

Dim $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))
  • 3 months later...
Posted

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

  • 3 weeks later...
Posted

@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

Ptrex,

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

Posted

@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

  • 6 months later...
  • 1 month later...
Posted

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.

  • 4 weeks later...
Posted

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??

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...