Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue exporting certain reports to pdf #40

Open
danielleevandenbosch opened this issue Apr 8, 2021 · 11 comments
Open

Issue exporting certain reports to pdf #40

danielleevandenbosch opened this issue Apr 8, 2021 · 11 comments

Comments

@danielleevandenbosch
Copy link

danielleevandenbosch commented Apr 8, 2021

I have the following problem. I will describe what worked and what didn't.
If it matters, the crystal reports connect to a Progress OpenEdge Database.
The reports by themselves in the application SAP Crystal Reports 2016 natively works just fine.
I have organized the error I am facing in the following spreadsheet.
the main error message is as follows:
`

08-04-2021 07:14:55 Message: Failed to retrieve data from the database.

Error in File Invoice 5276_11324_{E0F1808B-40FA-41B2-87B2-535B32E0849D}.rpt:
Failed to retrieve data from the database.
Details: [Database Vendor Code: -210083 ]
08-04-2021 07:14:55 HResult: -2147221760
08-04-2021 07:14:55 Data: System.Collections.ListDictionaryInternal
08-04-2021 07:14:55 Inner Exception: System.Runtime.InteropServices.COMException (0x800002D3): Failed to retrieve data from the database.

`

https://drive.google.com/file/d/19VptgfVy83J65tdPfuEd7T9IriQwq-nD/view?usp=sharing

@mhertzfeld
Copy link
Owner

@danielleevandenbosch unfortunately problems with sub-reports are the most common issue reported for ninja and are difficult to troubleshoot because replicating the problem on my side is next to impossible. Someone would essentially have to recreate their report with the same issue using the adventure works database then send it to me so that I can run it myself in my development environment for me to really get anywhere figuring out the problem. I've tried creating a report with a few sub-reports that has an error but they always work. I think you saw the same thing in one of your scenarios where a report with a sub-report worked ok.

The Crystal Reports developer is a lot more forgiving when it comes to subreports than ninja. Even though on the backend their engines should be pretty similar.

Previously reported issues with subreports have been resolved by making changes to the crystal report itself. See issue 36 linked at the bottom as an example. You may want to start looking at how the sub-reports are linked.

In your successful test scenarios, were you connecting to the same database as you are in the scenario that failed?

is ninja running on the same computer as crystal developer? running as the same user?

How are you connecting to the database? ODBC? I haven't heard of Progress Openedge database before. Are you using the same authentication method for all your database calls?

How did you do the SQLs in your report? Are they all stored procedures? Custom SQL statements? Or SQLs crystal put together?

Searching around for the vendor code, only thing I could find was this. It doesn't help much, but it does hint that there may be some stale configuration data lurking in the crystal report in that specific scenario.

http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22156

Here are other links directly related to ninja you may want to check.

#36

#29

#37

I gotta run now, but I will take another look at it tomorrow.

@mhertzfeld
Copy link
Owner

pinging @fabian-sta and @jostrander for their input.

@fabian-sta
Copy link
Collaborator

@danielleevandenbosch
As per any issue, go back to basics
If you can Duplicate the report and strip it down to the bare minimum and then build is back up
ie. run with out any sub reports, then add one subreport and get it working
Once that works From there should be easy going

@danielleevandenbosch
Copy link
Author

It would seem at this time, I ended up solving the issue. Although this might come from my lack of knowledge of the inner workings of crystal reports, I ended up commenting out the line in the project under the run method the call to // PerformDBLogin();. I was assuming this was a vital part of the process and required to run the report.

@mhertzfeld
Copy link
Owner

Interesting.

Are you passing any of the following parameters when running ninja?

 Server Name
 Database
 User
 Password

I am wondering what the results would be if you left all those parameters out and ran ninja again with the PerformDBLogin(); method in play. Just glancing over the code but I think the results would be the same.

If you had the Server, DB, User and Password saved in the report it would probably make sense for the report to run ok without executing that function since it's essentially just passing the DB info and user info into the report prior to running it. However as long as what you're passing into ninja using the parameters is valid then it "shouldn't" make a difference. However, I have no clue on how the reports built so its all just guessing on my part. For all I know you could be calling a handful of different stored procedures each with a different user\password or even stored procs on different databases.

Regardless I am glad to hear it is working for you, that's the most important part.

@mhertzfeld
Copy link
Owner

As I look closer at the code called in that method, it's assuming that the Server, Database,User and Password will be the same value for each "table" in the crystal report. If they are different then I can see an error popping up.

Something like that will be tough to handle with the way parameters are passed into ninja. Off the top of my head, I'm thinking I'd have to add a configuration file option or something like that where the user could specify each "table" in the crystal and the DB Info and user credentials that go with each table.

Are you able to go through your report and check the DB info and User creds for each "table" to help confirm this theory?

@danielleevandenbosch
Copy link
Author

danielleevandenbosch commented Apr 27, 2021

I was actually leaving it all blank. The code below is the batch file I used(all 1 line). (Note I manually put the invoice.rpt file in the bin\debug directory)
"C:\Users\itcon2\Documents\vandatatickets\1613\matthertfeld\CrystalReportsNinja\Source\CrystalReportsNinja\bin\Debug\CrystalReportsNinja.exe" -F "C:\Users\itcon2\Documents\vandatatickets\1613\matthertfeld\CrystalReportsNinja\Source\CrystalReportsNinja\bin\Debug\invoice.rpt" -a "invoiceid:101111" -a "CompNum:10" -a "PrintLanguage:EN" -E pdf -O invoice.pdf

@danielleevandenbosch
Copy link
Author

So in my specific use case (And I might assume many others) each table uses the same database, user, password, and server. My question is (And you might be doing this already) can we create a parameter that will allow the user to skip the step PerformDBLogin(); I don't know what it would be called or how to define it in the help page. For the project I am working on, I simply commented it out as stated above and built the project.

@jostrander
Copy link

@danielleevandenbosch Does the latest change that got merged happen to fix the issue for you? I was struggling with an issue relating to database schema's not working in CRN versus the crystal reports software itself, and I found an old example where instead of completely overwriting the database credentials in PerformDBLogin(); we instead modify the existing database credentials by whats passed into the CLI if they are present. It was a small change, but what your describing sounds slightly similar.

@mhertzfeld
Copy link
Owner

I have started re-writing the PerformDBLogin function since it is a mess. Check the changes and let me know if you have any suggestions. Major change was adding another parameter for integrated security.

@jostrander Please post your changes so we can see what you had done on your end.

@mhertzfeld
Copy link
Owner

@danielleevandenbosch No rush. I haven't compiled yet, still have a few clean-ups I want to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants