Click here to Skip to main content
15,904,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI..

I created an exe file using vb6.0 to run a crystal report file at command-line.
Its working fine. But i want to pass the parameters to the crystal report file at command-line.

Can anybody help me in this regards...

Please see the following snaps for references.

VB code

<img src="http://www.freeimagehosting.net/t/xtuko.jpg">


Command Prompt check

<img src="http://www.freeimagehosting.net/newuploads/wb2oo.jpg">

Report Output
<img src="http://www.freeimagehosting.net/newuploads/57a4a.jpg">
Posted
Comments
PRAKASH_N 17-Oct-12 2:59am    
Code


Private Sub Form_Load()
If Len(Interaction.Command$) > 0 Then

CrystalReport1.ReportFileName = Interaction.Command$
'If Len(StQry) > 0 Then
' CrystalReport1.SQLQuery = StQry
'End If
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = True
Else
ErrMsgBox.Caption = "... Report Name Not Supplied ..."
End If
Form1.ZOrder (0)
End Sub

Private Sub Label1_Click()
Unload Me
End Sub

1 solution

It is possible to pass other parameters, it just depends on how your query and report are designed (Peoplesoft delivers some reports of each design type). The suggested method of creating a run control record, joining to that record in your query, then passing just the OPERID and RUN_CONTROL to the Crystal report is one method.

For an example of this in the Financial system (not sure which modules you have) look at the delivered crystal report (and associated pages) for APY1011- (this is a control group register from the AP system), it passes the OPERID and RUN_CONTROL to the crystal report at the end of the parameter line (HANSBERK, and KARRIEH_AP are the passed values respecively):
C:\fs\fs850\BIN\CLIENT\WINX86\PSCRRUN.EXE -CTORACLE -CDFSPRD -COHANSBERK -CPOPRPSWD -I741559 -RP"APY1011-" -OT6 -OP"C:\fs\FS850CFG\appserv\prcs\FSPRD\log_outp ut\CRW_APY1011-_741559" -LGENG -OF2 -ORIENTL "HANSBERK" "KARRIEH_AP"

The other design is to skip the run control record/page concept and just pass the parameters directly to the query/crystal report, for an example of this method check out the GLC7501- report (Journal Entry Print called from the dropdown process box on the Journal Lines tab), it passes the business unit, Journal ID, and Date to the query/crystal report (last 3 values in the parameter line: CWUID, 0000235667, & 2010-12-30 respectively):
C:\fs\fs850\BIN\CLIENT\WINX86\PSCRRUN.EXE -CTORACLE -CDFSPRD -COAUXSTUD1 -CPOPRPSWD -I741607 -RP"GLC7501-" -OT6 -OP"C:\fs\FS850CFG\appserv\prcs\FSPRD\log_outp ut\CRW_GLC7501-_741607" -LGENG -OF2 "ENG" -ORIENTL "CWUID" "0000235667" "2010-12-30"

So there should be the ability to pass any parameters you want to the underlying query/crystal report, it just depends on how you design and build the query/report as to what type of info you need to pass it. If passing many values to the report, the run control option would probably be better, as there can be issues with excessively long command lines getting truncated and we have seen some parameters get dropped when the command line gets too long which can cause strange results.
 
Share this answer
 
Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900