cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ReportDocument Serialization Error v13sp2

Former Member
0 Kudos
457

I posted this a week or so ago and no one responded. So I'm putting it up again. All I am trying to do is get the reportdocument object to serialize and store that in session. It should be pretty simple. But when I call out to the RAS DLL to serialize it, it returns null. Even for a report with just a single label on it.

I'm trying to understand how the RAS provided classes can be used to serialize a reportdocument into a string. I have seen many examples from the help and other threads, from my own threads, etc. But for whatever reason I cannot get even the most basic report to serialize to a string. So I must be missing a required step or I have the wrong version of Crystal. I downloaded the latest I could find, which was version 13 release 2. I have just the free basic Crystal developer edition for VS.Net 2010.

1.) What I did was create a report class and put a single label on the report. Then I run the report. It works fine.

2.) Then I coded a simple web page to display the report using the CrystalReportsViewer. That works fine.

3.) Then I tried to setup a test to serialize the report as a string using the RAS Utilities Conversion DLL. That doesn't work.

In this example, I am just trying to get the string to be equal to something. Currently it is always set to nothing/null when this runs.

Here's the code I am testing. Am I missing something?

Dim myReport As New CrystalReport1  u2018Empty report with just a label in the header.
myReport.VerifyDatabase()
 
'***Serialize 
Dim boReportClientDocument As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument
boReportClientDocument = myReport.ReportClientDocument
 
Dim myConversion As CrystalDecisions.ReportAppServer.Utilities.Conversion = New CrystalDecisions.ReportAppServer.Utilities.Conversion
Dim mySerializedRcd As String = myConversion.ToString(boReportClientDocument)
CrystalReportViewer1.ReportSource = boReportClientDocument.ReportSource

Any guidance or suggestions would be much appreciated. I have gone through the SDK help and setup things as they show. But it just doesn't work for me. I must be missing something. The samples look pretty simple.

Any thoughts?

Best regards,

Jon

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

See this post for Jon other post:

Hi Jon,

Why are you trying to Serialize the report object if the reprots are simply saved on your PC?

That function to be used with a BOE Server where the reports are saved in the CMS Database. It's not for standalone unmanaged report objects.

And CR for VS 2010 doesn't ahve connectivity to BOE 4.0 or any other version.

Go to help.sap.com and get the RAS SDK help chm file and then search:

Report Application Server .NET SDK Developer Guide

To Serialize the ReportClientDocument

Collapse All Expand All Language Filter:All Language Filter:Multiple Language Filter:Visual Basic Language Filter:C# Language Filter:C++ Language Filter:J# Language Filter:JScript

Visual Basic (Declaration)

Visual Basic (Usage)

C#

C++

J#

JScript

To serialize a report:

Create an instance of the Conversion class.

Use the Conversion.ToString method to serialize the ReportClientDocument object.

Return the serialized ReportClientDocument.

Visual Basic Copy Code

Private Function SerializeRCD(ByVal rcd As ISCDReportClientDocument) As String

Dim conversion As New CrystalDecisions.ReportAppServer.Utilities.Conversion()

Dim serializedRCD As String = conversion.ToString(rcd)

Return serializedRCD

End Function

C# Copy Code

private String SerializeRCD(ISCDReportClientDocument rcd)

{

CrystalDecisions.ReportAppServer.Utilities.Conversion conversion = new CrystalDecisions.ReportAppServer.Utilities.Conversion();

String serializedRCD = conversion.ToString(rcd);

return serializedRCD;

}

This list includes the namespaces used by the sample code:

CrystalDecisions.Enterprise

CrystalDecisions.ReportAppServer.ClientDoc

CrystalDecisions.ReportAppServer.DataSetConversion

NOTE: the above indicates you need CrystalDecisions.Enterprise which doesn't exist in CR for VS 2010.

Don

Edited by: Don Williams on Dec 17, 2011 3:01 PM

Former Member
0 Kudos

Thanks for your comments. Please help me with this. I'm really struggling here because it looks like Crystal cannot work for me.

It seems that to put a Crystal report on a webpage, that you need to push it into session to allow it to page. Is that correct?

We are running a large website, sort of an HR app for a large company with 15,000 users. There are 5,000 current users and there can be as many as 1,000 on the site at the same time. So it's a pretty large app today. We are enhancing it to handle a few other countries and run at 15,000+ users and probably about 1,000 concurrent users. So we need reporting tool that can handle that.

Due to the size of the the app we are using SQL to hold our session state across a server farm. This is the problem we are running into. When we do this for Crystal so we can page, the report cannot go into SQL server because it has to be serializable to do that.

If we can page without using session, which I don't think we can, or if we can get SQL server to NOT put the report into session, or if we can serialize the report so it will go into session and into SQL server, then we are ok. If not, it sounds like we need the full blown RAS server.

We could go back to a pervious version of Crystal if this is available there. We do not care about the version. We can go all the way back to 10.2 if we need to. We started with that.

What I have to avoid is a $7K to $20K license cost for this. The heads of this project know that we can do this in SQL server or a 3rd party reporting tool like ActiveReports. So they will force me to migrate the reports. But that is not what I want to do. We have been using Crystal for probably 10-years now and I do not want to change. But I think I have to!

Let me know if I am wrong. I hope I am. What options do I have? All I want to do is page the report on a website. Nothing more. they will not give me the funds for RAS Server at $7K to $20K or more. That is not an option.

Greg

Former Member
0 Kudos

Hmm - interesting that on this thread you sign as Greg, on your other thread you sign and Jon...

Irrespective, see my answer on the other thread:

- Ludek

Former Member
0 Kudos

Ludek,

Thanks for all of your help on this. I am just getting frustrated because I cannot figure out what SAP/CR wants me to do to get this to work. There seems to be lots of options and every option has a roadblock. It looks like the roadmap for upgrade from Crystal v10.2 to whatever version works for VS2010 is an infinite loop and I am going around and around. I'm just trying to figure out what I am supposed to do. In the end, I just need to get the reports to work. I don't care which version, which technology, etc. I just need them to work. Currently they do not the second I turn on SQL Server state management.

So maybe I should just back up and ask a simple question. Here's my question:

I have a VS.Net 2005 application running Crystal Reports 10.2 and I need to upgrade it to run on a server farm using SQL Server to hold the session state. I am using the Crystal Reports Web View control to display the pages but that is not required. I use the outline (not sure of it's real name) on the viewer control to allow users to jump to client specific pages within the report. I need that to be supported going forward, so I cannot use a PDF dump of the reports unless the outline is still there. I am currently using ASPX VB.Net and C# for VS 2010.

What is the upgrade path to migrate these reports to ASPX using VS 2010 with SQL Server managing the session state?

Any information, suggestions, or guidenace is much apprecaited as I am at an impass with the product and I have no idea where to go from here or if Crystal can support our needs.

Best regards,

Jon Gregory Rothlander

Ludek: You asked about Greg/Jon. My parents played a bad trck on me. Jon is my first name, hense my user id of jrothlander. But I have always gone by my middle name. I use Jon for things that are formal and tend to use it on the web. Jon... Greg... same guy... my mother and grandmother call me Jon Gregory when I am in trouble. I respond to them all. Sorry for the confusion.

Former Member
0 Kudos

Ludek,

What about if I create a second website JUST for Crystal and the reports? Then on that website DO NOT set it up to use SQL Server to maintain the session state. If I can figure out a way to pass the report parameters from the one web site to the other via say a querystring or maybe even an encrypted querystring, this should work. Do you see any issue with that?

But really, what is the SAP/CR suggest solution for this? I guess that is really what I need to know..

Jon

Former Member
0 Kudos

Hi Jon,

3 years later but I think I have found a way, is it too late?

cache.add is a .NET function that return an object

So you could store it like this:

                        Cache.Insert("crReportDocument", crReportDocument, Nothing, DateTime.Now.AddMinutes(10), Cache.NoSlidingExpiration)

                        CrystalReportViewer1.ReportSource = crReportDocument

And then get it back on page_load or page_init in case it is a postback:

                            Dim crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument() 'frv11272013

                            crReportDocument = CType(Cache.Add("crReportDocument", crReportDocument, Nothing, DateTime.Now.AddMinutes(10), Cache.NoSlidingExpiration, CacheItemPriority.Normal, Nothing), CrystalDecisions.CrystalReports.Engine.ReportDocument)

                            CrystalReportViewer1.ReportSource = crReportDocument

                            CrystalReportViewer1.Visible = True

It works fast

Regards,

Fred

Former Member
0 Kudos

Hey Fred,

Thanks for posting. It has been a while, but I remember it well.

I think the real issue was not that I could put cache the report, but that in doing so the serialization logic in the Crystal Reports code base did not correctly serialize and deserialize some values.  So if you had a .Net date field and cached it, once you pulled it back from cache the CR code would crash.  If I recall, I went through the report fields one at a time and changed them to something that would work... probably changed the date fields to strings or something.  But it's been too long to know what I did.  But i was able to work through it.

Hopefully others will be able to benefit form this old thread.

Former Member
0 Kudos

Jon,

I can tell you that I have many reports with date parameters and they are working just fine.

Some questions are:

Could it be better that I did not even try to serialize it?

Maybe the object goes in and out the cache as it is with no serialization?

Or could it be because I do not reload parameters on page load anymore once the document is produced and stored comes right back as a whole?

Regards,

Fred

Former Member
0 Kudos

If you are pushing it into cache, it is being serialized for you. It's been too long for me to remember what the issue was, but I recall the date fields (from what I recall, .Net and CR dates are not 100% compatable) and I think there was another field/type as well that had issues.  But the key is that the date fields were parameters on the report and a .Net date was being passed into the report.  Maybe that is the difference.

If you are doing the same thing and it is working for you, then I would guess there is something here is a bit different, or they resolved this issue. But your apporach look valid and very similar to how I was doing things back then.

Answers (0)