rainforestnet / CrystalReportsNinja

A small Windows Console App that loads external Crystal Reports file, takes parameter inputs and export to various format or even print to printer
http://www.rainforestnet.com
93 stars 77 forks source link

Dynamic Parameter Passing to the one crystal report rpt file #45

Open ayeayemaw08ucsy opened 4 years ago

ayeayemaw08ucsy commented 4 years ago

I want to pass dynamic parameter to one crystal report rpt file . For example I have 250 branches and i want to pass parameter with looping from command line. The crystal report file is used with the dynamic parameter field .When i export the rpt file from crystal Ninja with parameter which is map with rpt's file parameter file parameter .If parameter is same , the report of pdf format is successfully generated .When I passed the second parameter with looping ,the follwing error is occured. image

mhertzfeld commented 4 years ago

Odd that you would be getting a log on error on the second execution but not the first.

Make sure the option to save data within the crystal report is unchecked.

It may help with troubleshooting if you post your entire script including how you are performing the loop.

mishrasatyam commented 4 years ago

I am also getting same issue. command: CrystalReportsNinja.exe -u username -p password -f filename.rpt -E pdf -a "parameter1:value1" -a "parameter2:value2"

1.If parameter value is same as parameter value in .rpt file, then pdf is generating successfully. 2.If parameter value is different from parameter value in .rpt file, then pdf is not generating and I am getting following error:

Error in File filename 1588814948{EEA9A5DC-1293-4441-A9B9-6D37AC82DF6E}.rpt: Failed to load database information. Error in File filename 1588814948{EEA9A5DC-1293-4441-A9B9-6D37AC82DF6E}.rpt:iled to load database information. Failed to load database information. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

ayeayemaw08ucsy commented 4 years ago

Odd that you would be getting a log on error on the second execution but not the first.

Make sure the option to save data within the crystal report is unchecked.

It may help with troubleshooting if you post your entire script including how you are performing the loop.

Hello mhertzmeld You suggest that "Make sure the option to save data within the crystal report is unchecked." That meaning is i need to be prepared manually for 250 rpt file of 250 branches parameter. But rpt file template is same and only different in parameter .I don't want to do like that manually. That why I use looping and pass parameter dynamically from CrystalNinja to one rpt file.

If you have any idea for above scenario ,Please Let me know. If any other csharp library file for that case ,pls let me know.

Thanks AAM

mhertzfeld commented 4 years ago

You should only need one crystal report file, your template. You will loop through your list of branches and execute ninja for each branch, specifying the branch in the parameter.

Also, if you are using the 64bit version of Ninja you need to make sure that you are using the 64bit version of the ODBC driver, or if you are using the 32bit version of ninja you need to make sure you are using the 32bit version of the ODBC driver.

mishrasatyam commented 4 years ago

Hi, @mhertzfeld can we have skype call regarding this if you don't mind?

ayeayemaw08ucsy commented 4 years ago

You should only need one crystal report file, your template. You will loop through your list of branches and execute ninja for each branch, specifying the branch in the parameter.

Also, if you are using the 64bit version of Ninja you need to make sure that you are using the 64bit version of the ODBC driver, or if you are using the 32bit version of ninja you need to make sure you are using the 32bit version of the ODBC driver.

Hello mhertzfeld,

I have been already tried on 32 bit verson of Ninja because of our crystal server is used 32 bit ODBC driver.Same Error are coming. Do u have any idea to overcome this error.

image Can u help me ! If possible , can u give me a few session of skype discussion with my team.

Thanks AAM

mhertzfeld commented 4 years ago

I will not have time for a call until next week. I will try to help you here for now.

I've never worked with an Oracle DB before. I typically work on SQL Server and DB2. But the DB you are using shouldn't really matter to Crystal or Ninja. However the way you are trying to connect to the DB may matter.

On the first execution where ninja is running ok, do you think ninja is connecting to the database and pulling data from the DB or do you think it may be using data that has been saved in the rpt file? It doesn't make sense to me that on the first execution you would be able to connect to the database and pull data ok but on the second execution you would be having problems connecting to the database. Especially if the script is essentially the same except for the branch number being different.

Disable the "Save data in report" option and run it for a branch 1 where it was executing ok. Do you get an error now?

Are you able to try using an ODBC DSN instead of a JDBC? Here are some issues related to Oracle and JDBC.

https://github.com/rainforestnet/CrystalReportsNinja/issues/4 https://github.com/rainforestnet/CrystalReportsNinja/issues/15 https://github.com/rainforestnet/CrystalReportsNinja/issues/34

Also, once you get this working you may want to look at my fork of Ninja. It has some additional features and bug fixes that aren't in the original version of Ninja. The newest branch I am working on will make it easier to run Ninja using PowerShell (see the powershell portion of the readme).

https://github.com/mhertzfeld/CrystalReportsNinja