Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

help with passing parameters to a Crystal report in PERL

by harish (Novice)
on May 16, 2003 at 15:20 UTC ( [id://258681]=perlquestion: print w/replies, xml ) Need Help??

harish has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I need help with passing parameters to a crystal report. The Code below works fine and it even generates the Excel file from a existing Crystal Report. But the excel file does not have any data..

Any help is greatly appreciated.
Harish

use Win32::ODBC; use Win32::OLE; use Win32::OLE::Variant; #### Create the Crystal Report RunTime Instance ###################### +####### $ex = Win32::OLE->new('CrystalRuntime.Application', sub {$_[0]->Quit;} +) or die "Oops, cannot start Crystal"; $oReport = $ex->OpenReport('C:\CrystalParameters\Myreportone.rpt', 1) +; $oReport->{'EnableParameterPrompting'} = 0 ; $oexportoptions = $oReport->{'ExportOptions'} ; $cParameterFields = $oReport->{'ParameterFields'} ; #########Add Default Values################################## ######################################################## $prms = $cParameterFields->Count; for ($x = 1 ; $x <= $prms ; $x++){ $oParameterField = $cParameterFields->Item($x) ; $tmp = $oParameterField->{'ParameterFieldName'} ; $tmp = substr($tmp,1,length($tmp)-1) ; if ($tmp eq "tradedate2"){ $tt = 0 ; $tt = $oParameterField->{'IsCurrentValueSet'} ; if ($tt eq 0) { $oParameterField->ClearCurrentValueAndRange ; $oParameterField->AddCurrentValue("01/31/03") ; } } if ($tmp eq "mode"){ $tt = 0 ; $tt = $oParameterField->{'IsCurrentValueSet'} ; if ($tt eq 0) { $oParameterField->ClearCurrentValueAndRange ; $oParameterField->AddCurrentValue("MONTH") ; } } } # end of the for loop ############################################################ + + #######set the Export Options to Export it to Excel file ############# +##### $oexportoptions->{'FormatType'} = 36 ; $oexportoptions->{'DestinationType'} = 1 ; $oexportoptions->{'DiskFileName'} = 'c:\mytestreportone.xls' ; ####################################################### $oReport->Export(Variant(VT_BOOL, 0));

update (broquaint): added <code> tags

Replies are listed 'Best First'.
(jeffa) Re: help with passing parameters to a Crystal report in PERL
by jeffa (Bishop) on May 16, 2003 at 15:30 UTC
    Hello harish. I do not have an answer to your question. Instead i am posting to ask you to please use code tags. I editted your most recent question and noticed that you inserted <br> tags at the end of each line. This is uneccesary. Simply put code tags around your code and the proper formatting will be substituted for you. I also sent you a private message explaining that i fixed your last most recent question and requesting that you now fix Re: Re: Converting Visual Basic Code to PERL yourself. I see that you did not heed my request, hence this reply. The advice to use code tags should have been right in front of you when you posted:
    • Are you posting in the right place? Check out Where do I post X? to know for sure.
    • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following: a, b, big, blockquote, br, center, dd, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, li, ol, p, pre, readmore, small, span, strike, strong, sub, sup, table, td, th, tr, tt, u, ul
    • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible editor intervention).
    • Want more info? How to link or How to display code and escape characters are good places to start.
    Did you not see that? By taking the time to fit in with a communtity, you only ensure that your reception will be better received. Oh, and it's Perl by the way. Not PERL. Thanks.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://258681]
Approved by Jenda
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-18 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found