Caching report with RAS SDK
I have an application that runs reports using the RAS SDK in BO Enterprise XIr2. The application uses RAS to retrieve the report from BO XI and manipulates the report be changing the database connection information (ODBC DSN name, user name, and password). It also changes the parameters of the report dynamically and then displayes it within a web page using the .NET Report Viewer control.
My problem is that the Cache Server never seems to cache any of the reports. The settings for the cache server are set high so it should still be in cache. Clicking on the next and previous page buttons will always rerun the entire report. Are there configuration settings I am missing? Should the code be doing something in order to handle the next and previous buttons? Just looking for pointers on where to continue my exploration of this problem.
Thanks
The Report Application Server does its own caching internally.
The Crystal Report Cache Server caches for the Crystal Report Page Server.
Specific to your issue, are you caching the ReportObject in HTTP Session, and retrieving it on postback? Or are you opening a new ReportClientDocument each time? That sounds like not a server-side caching issue, but application side caching issue.
Sincerely,
Ted Ueda
Similar Messages
-
How to create cross tab reports using RAS SDK api with Crystal Reports XI
Hi Everybody,
Iam generating reports in a web-based application with Crystal Reports XI using Report Application Server(RAS) SDK API. The columns in my report exceed that of an A4 sized page. So, when I export that report to pdf, only those columns that fit to a page are showing up. To solve, this problem, I thought of using cross tab. But, I donot know how to generate cross tab report using RAS SDK API. I have tried to get some code from the internet. But, I did not find any java code for that.Can some one give me some sample code.It is very urgent.
Thanks in advance.Hi,
The easiest way I use is to create the worksheet as regular table and then when i verify the data I get (non aggregate) I duplicate it as a cross tab.
In the duplication wizard I just need to define the axis (using drag and drop).
if you want to create a cross tab from the beginning you need to define that in the new workbook wizard (check the "cross tab" rather then "table"), chose your fields and define the place you want them.
The data point (the center of the cross tab) is aggregated as to your machine definition and will happen automatically.
for example: to find the amount of receipt by months:
On the left put the "Buyer Name", on top put the "Months" and in the data point put the amount.
What you'll get is something like:
months: jan feb mar apr ......
buyer_name
jhon_smith 100 50 30 250 ......
jhon_doe 80 45 90 453 ........
and so on..... -
Setting the height of detail section with RAS SDK
Hi, all,
is it possible to locate a section (CrystalDecisions.ReportAppServer.ReportDefModel.Section) in a reportk you and set its maximum height?
When I find a detail section in question like so section = reportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[counter];
it just gives me the height of one row.
Is there a way to set a maximum size of it?
Thank you!Hi Jelena,
see the below sample to add a new section to the report.
http://scn.sap.com/docs/DOC-6025
in the sample, see below code how the section properties are set.
//Set the properties for the section
boSection.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail;
boSection.Name = "Detail2";
boSection.Height = 1000;
boSection.Width = 11520;
Refer to above sample and write your own code to identify the section and then set the properties.
Othe RAS SDk samples are here.
http://scn.sap.com/docs/DOC-28646
- Bhushan
Senior Engineer
SAP Active Global Support
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
Getting started and moving ahead with Crystal Reports .NET applications. -
Logon Error when SetTableLocation with RAS SDK
Hi
I have a lot of Reports based on TTX files. As these don't work anymore in an 64 bit environment with CRVS2010 I tried to make an update program based on an replace_click sample in this newsgroup.
My program is 32 Bit (x86) on an Windows 7 with VS2010. Cr2010 SP1 (13.0.1.220) 32 and 64 Bit is installed.
After creating an XML-file I want to set the new table location with SetTableLocation method:
I always get this Error: Logon Failed. Error in File xxx.rpt: Unable to connect: incorrect log on parameters.
I tested this with two super easy reports created with Crystal Reports 10:
First: 1 Table (based on ttx) with only one String filed. no subreports.
Second: Same report based on an XML File
With Crystal Reports 10 I can update the Report with the created XML-File.
public convert(NewFilename as String)
Dim lCR As New CrystalDecisions.CrystalReports.Engine.ReportDocument
lCR = New CrystalDecisions.CrystalReports.Engine.ReportDocument
Try
lCR.Load(NewFileName)
Dim rcd As ISCDReportClientDocument
rcd = lCR.ReportClientDocument
For i As Integer = 0 To rcd.SubreportController.GetSubreportNames.Count - 1
ConvertReportTables(NewFileName, rcd, rcd.SubreportController.GetSubreportNames.Item(i), True)
Next
ConvertReportTables(NewFileName, rcd, "", False)
end sub
Jürgen
Edited by: Jürgen Bauer on Jun 7, 2011 1:55 PMPrivate Sub ConvertReportTables(ByRef destination As String, ByRef lcr As ISCDReportClientDocument, srp As String, issubrpt As Boolean)
Dim boTables As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTables
If issubrpt Then
boTables = lcr.SubreportController.GetSubreport(srp).DatabaseController.Database.Tables
Else
boTables = lcr.DatabaseController.Database.Tables
End If
For Each Table As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable In boTables
'Dateiname für Tabellendefinition erzeugen
Dim XMLFile As String
XMLFile = destination
XMLFile &= "_R_" & srp
XMLFile &= "_T_" & Table.Name.Trim & ".xml"
'Tabellendefinition lesen und in Datei schreiben
Dim dt As New DataTable
For Each field As CrystalDecisions.ReportAppServer.DataDefModel.Field In Table.DataFields
Dim fieldtype As String = ""
Select Case field.Type
Case FieldValueType.BitmapField, FieldValueType.BlobField, FieldValueType.IconField, FieldValueType.OleField, FieldValueType.PictureField
fieldtype = "System.Byte[]"
Case FieldValueType.BooleanField
fieldtype = "System.Boolean"
Case FieldValueType.CurrencyField, FieldValueType.NumberField
fieldtype = "System.Decimal"
Case FieldValueType.TimeField, FieldValueType.DateField, FieldValueType.DateTimeField
fieldtype = "System.DateTime"
Case FieldValueType.Int16sField, FieldValueType.Int16uField, FieldValueType.Int32sField, FieldValueType.Int32uField, FieldValueType.Int8sField, FieldValueType.Int8uField
fieldtype = "System.Int32"
Case FieldValueType.StringField
fieldtype = "System.String"
Case Else
fieldtype = "System.String"
End Select
dt.Columns.Add(New DataColumn(field.Name, Type.GetType(fieldtype)))
Next
dt.TableName = Table.QualifiedName
Dim ds As New System.Data.DataSet
ds.Tables.Add(dt)
ds.WriteXml(XMLFile, XmlWriteMode.WriteSchema)
'boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
Dim boMainPropertyBag As New PropertyBag()
'boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
'In the main property bag (boMainPropertyBag)
Dim boInnerPropertyBag As New PropertyBag()
'Set the attributes for the boInnerPropertyBag
boInnerPropertyBag.Add("File Path", XMLFile)
boInnerPropertyBag.Add("Internal Connection ID", Guid.NewGuid.ToString)
'Set the attributes for the boMainPropertyBag
boMainPropertyBag.Add("Database DLL", "crdb_adoplus.dll")
boMainPropertyBag.Add("QE_DatabaseName", "")
boMainPropertyBag.Add("QE_DatabaseType", "ADO.NET (XML)")
'Add the QE_LogonProperties we set in the boInnerPropertyBag Object
boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag)
boMainPropertyBag.Add("QE_ServerDescription", "NewDataSet")
boMainPropertyBag.Add("QE_SQLDB", "False")
boMainPropertyBag.Add("SSO Enabled", "False")
'Create a new ConnectionInfo object
Dim boConnectionInfo As New CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo()
'Pass the database properties to a connection info object
boConnectionInfo.Attributes = boMainPropertyBag
'Set the connection kind
boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE
Dim boTable As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable
boTable = Table.Clone(True)
boTable.ConnectionInfo = boConnectionInfo
Try
If issubrpt Then
lcr.SubreportController.GetSubreport(srp).DatabaseController.SetTableLocation(Table, boTable)
lcr.VerifyDatabase()
Else
lcr.DatabaseController.SetTableLocationEx(Table, boTable)
lcr.VerifyDatabase()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
End Sub -
How do i retrieve the total number of pages in a report-- via RAS SDK
CrystalReportViewer has
showFirstPage()
showLastPage()
showNextPage()
showNthPage(int pageNumber)
showPreviousPage().
But how I determine the number of pages for a report. Our app handles pagination and hence this requirement.
Thanks.
JMThere's no public API to get this info directly from RAS.
Option is to either walk through pages in the CrystalReportViewer till you get to the end, or use the non-public not-for-public use API:
int lastPageNumber = ((com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource) reportClientDocument.getReportSource()).getLastPageNumber(new com.crystaldecisions.sdk.occa.report.reportsource.RequestContext());
Sincerely,
Ted Ueda -
Cannot Refresh a report with WS SDK
Hello,
I am trying to refresh a webI report using the WebService SDK (XI R2 SP2) with the following code
Action[] oActions = new Action[1];
oActions[0]=new Refresh();
boDocumentInformation = oReportEngine.getDocumentInformation(repID, null, oActions, null, boRetrieveData);
I get the report I want - but it is not refreshed
Can anyone help
Thanks
GaryHi,
I have a same Pb, can you give me the response.
Thinks, -
Loading image in Crystal Reports using RAS SDK
Hello,
I have a weird problem when I try to add dynamically an to a report.
CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject boPictureObject;
boPictureObject = boReportClientDocument.ReportDefController.ReportObjectController.ImportPicture(
HttpContext.Current.Server.MapPath(imageURL), boSection, 1, 1);
The program rise a COMException with the following message "The specified path was not found.". I verified the path I'm using and it's fine. Is there another cause for this exception?!
Edited by: Rahma Sayari on Feb 23, 2012 4:32 PMHello
I don't think there is another reason for the error.
I'd like you to try the code as follows though:
boPictureObject = boReportClientDocument.ReportDefController.ReportObjectController.ImportPicture(Server.MapPath("my_image.jpg"), boSection, 1, 1);
E.g.; I do wonder if using HttpContext.Current.Server.MapPath(imageURL) is the issue here (permissions, etc., etc.)
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
How to retrieve total number of pages in a report of Instance - RAS SDK ?
Hello All,
Hope all is well. I am using BOXI R2 Enterprise and was wondering how to get total # of pages of an Crystal Report Instance using RAS SDK.
Thanks in advance,
SamHow do i retrieve the total number of pages in a report-- via RAS SDK
Sincerely,
Ted Ueda -
We are planning to develop a reporting application which will create entire report using RAS SDK and display them in DHTML using Viewer SDK. In our application we donu2019t have any physical RPT file stored on Server because application users will design the report through a java user interface and then run it.I want to know what are pros and cons of this approach.
We have around 2000 reports.RAS SDK has all the functionality to create a crystal report from scratch and you can also view it so there should be no concern. However RAS is not optimized for report viewing so if you have too many concurrent report jobs on RAS or reports with multiple subreports that could cause a performance bottleneck.
-
Is it OK to open a CR Report with JRC/Gemini which is modified by RAS SDK?
Dear all
Is it OK to open a CR Report with JRC/Gemini which is modified by RAS SDK? Especially after I use RAS SDK to change report database location.
I test it OK, but my Customer need to confirm this.
Thanks a lot.
DavidRAS SDK - meaning RAS server?
There's intrinsic limitations for Crystal Reports Java (JRC for CR4E Version 2), such as database connectivity (only Java-based ones) when compared to RAS server.
But CRJ does support Crystal Reports 2008 reports within those limitations.
By the way, the new CR4E Version 2 Crystal Reports Java SDK is essentially the in-process RAS SDK - so you can make modifications using that. Note that JRC SDK (version 11.8 and below) are deprecated with CR4E Version 2), then new way si the the Crystal Reports Java SDK.
Sincerely,
Ted Ueda -
Crystal Report based on Universe and RAS SDK missing functionality
Hi,
In Crystal Report Designer Application i can select Universe as a data source for the Crystal Report and on the query panel construct the actual query using Universe objects and conditions.
Now, my question is how can i do the same PROGRAMMATICALLY. I.e. i want to make a new or take an existing crystal report, check if it's based on universe, then access the actual universe query structure and construct/modify the query by operating with the actual Universe objects and conditions.
I tried to use RAS SDK for this, but i could only access Tables that dont even show on which universe they are based on.
Should i use some other SDK to do this?
Thanks,
Roman.Thanks for your response. Ok, if it's so complicated, then i'm not concerned about universe query creation. I have more specific questions now:
1) You've said that CrystalReport stores Universe SI_CUID values that it connects to. Let's say i have 3 tables based on universes in the report. What is the best way to determing which universe correspond to which table using RAS SDK?
I looked at ConnectionInfo for each table, it sais that it's based on universe, but it DOES NOT have universe CUID property.
Using Enterprise SDK i can access SI_UNIVERSE_INFO of ProcessingInfo for report InfoObject and see the list of universes used, but they are not matched to the actual tables, so i cannot really find out which universe belongs to which table.
2) If EXISTING CrystalReport is based on Universe, is it possible to retrieve the actual universe objects and conditions used in this report? I can see that field names correspond to object names, BUT i also need a parent class name, becuase object is NOT identified by it's name only withing the universe. -
How to set Report Location by RAS SDK without configurating CCM in CR Serve
Dear all
When I use the RAS SDK with CR Server Embedded 2008, I found that when I use the Java code to open a report like below:
String localRptPath = "rassdk://C:
oem.rpt";
reportClientDoc.open(localRptPath,OpenReportOptions._openAsReadOnly);
But I must set the Report Directory from the default value(a specified location after CRSE installation)to " * " in CCM of the RAS Server like below:
Right click the RAS Server -> Choose "Propertites" -> Choose "Parameter" -> Change "Option Type" to "Server" -> set the Report Directory from the default value to " * "
Then I can open the report, otherwise I must put the report under the Default Location of the Report Directory.
So customer need a way which can set the report location directly in RAS SDK and without configurating the Report Direcroty in CCM?
Thanks in advance.
DavidDear all
I encounter some strange situation when editing the "Report Directory":
In my Vmware, there are 2 "ReportDirectoryPath" under:
HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Instances\bouser.RAS\Server\LocalConnectionMgr
and
HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Server\LocalConnectionMgr
I can only edit the "ReportDirectoryPath" in the former location and then take effectively in the CCM. And if I modify the "ReportDirectoryPath" in the latter location, it can not take effect.
But in customer machine, customer install CR2008 and CRASE2008, and customer can edit the value in the registry, but after customer uninstall the CR2008 and CRSE2008 then reinstall CRSE2008 only, the registry structure is different, there is not HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Instances\bouser.RAS\, so customer can only edit the "ReportDirectoryPath" under:
HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Server\LocalConnectionMgr
And it can work effectively.
And I can not rebuild this.
So I found that when there are 2 location of the "ReportDirectoryPath", I can only modify it under:
HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Instances\bouser.RAS\Server\LocalConnectionMgr
So my question is:
Why the registry structure is different after reinstall the CRSE2008?
Because customer need the firm registry location to modify it. -
Migrate from Crystal Report Server XI R2 to new Eclipse RAS SDK Question
Hi,
I am migrating Crystal Report Server XI R2 RAS SDK to Eclipse RAS SDK which seems to be quite easy.
I have the following old code which basicly programmaticly creates a Report from scratch adds a Table and then
populates the Report with a Pojo Collection.
<br> <br>
Now before I would have : <br>
<br>
Table oTable = new Table(); <br>
oTable.setName("reportTable"); <br>
pbConnAttributes.putStringValue("QE_DatabaseType", "Java Beans Connectivity"); <br>
pbConnAttributes.putStringValue(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_javabeans.dll"); <br>
PropertyBag pbLogonProperties = new PropertyBag(); <br>
pbLogonProperties.putStringValue("Java Bean Classes", className); <br>
pbLogonProperties.putStringValue("SSOKEY", ""); <br>
pbConnAttributes.put("QE_LogonProperties", pbLogonProperties); <br>
pbConnAttributes.putBooleanValue(PropertyBagHelper.CONNINFO_SSO_ENABLED, false); <br>
oTable.getConnectionInfo().setKind(ConnectionInfoKind.CRQE); <br>
oTable.getConnectionInfo().setUserName(""); <br>
oTable.getConnectionInfo().setPassword(null); <br>
oTable.getConnectionInfo().setAttributes(pbConnAttributes); <br>
//following statement throws Exception <br>
doc.getDatabaseController().addTable(oTable, null); <br>
<br>
getDatabaseController().setDataSource(pojoCollection, pojoClass.class,"reportTable", "reportTable");
<br>
<br>
Now wenn using the c <br>lient eclipse RAS SDK which pbConnAttributes should I use? <br>
No matter which ones I choose I get a Bad Driver Exception or Named Exception. <br>
Can anybody help?
Edited by: snake-john99 on Aug 11, 2010 10:35 AM
Edited by: snake-john99 on Aug 11, 2010 10:39 AMHi Mikael,
Since you're already on CR Server XI R2, you can use the Upgrade Management Tool to migrate all the content to CR Server 2013.
Anwers to your questions:
1) Yes, the Upgrade Management Tool does support this kind of migration
2) It does seem that the UMT allows you to move all report instances as well as the scheduled jobs over to the new server
3) I've always had issues with Business Views when using Import Wizard however I'm not sure whether they work well with the new UMT. In any case, I always prefer to export the LOVs and BVs from within the Business View Manager to a .xml file and then import them in the higher version of the Server, again, from within the Business View Manager.
-Abhilash -
Connection error -2147217387 with Java RAS SDK and Crystal Server 2011
Due to a change in operating system, we are required to upgrade our Crystal Reports server from BusinessObjects Crystal Reports Server 11.5 to SAP Crystal Server 2011. We use the Java RAS SDK (RASCore 9.2.2.446 / RASApp 9.0) more or less as described in Java RAS2008-unmanaged exportreport. We use the Crystal Server to export reports stored on disk as PDF files.
In SAP Crystal Server 2011, the CrystalReports2011ReportApplicationServer is configured with Request Port 1566 and Host Identifier 172.16.4.154 (the local machine). The Crystal Server, report-definition files, and Java VM are all on the same machine.
The error is
com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: XML serialization failed.---- Error code:-2147217387 Error code name:connectServer
at com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwReportSDKServerException(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.v.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.ab.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.do(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.for(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.for(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)
at ourpackage.OurClass.openReport(OurClass.java:95)
... 6 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.net.SocketInputStream.read(SocketInputStream.java:203)
at java.io.DataInputStream.readInt(DataInputStream.java:388)
The code is as follows.
ReportClientDocument clientDocument = new ReportClientDocument();
clientDocument.setReportAppServer("172.16.4.154:1566"); // localhost
// Error occurs on ReportClientDocument.open method
clientDocument.open("D:\\path\\to\\report.rpt", com.crystaldecisions.sdk.occa.report.application.OpenReportOptions.refreshRepositoryObjects.value());
DatabaseController dbController = clientDocument.getDatabaseController();
dbController.logon("dbuser", "dbpassword");
ParameterFieldController pfController = clientDocument.getDataDefController().getParameterFieldController();
Fields fields = clientDocument.getDataDefinition().getParameterFields();
ParameterField oldParameter = (ParameterField) field.get(0);
ParameterField newParameter = new ParameterField();
oldParameter.copyTo(newParameter, false);
newParameter.getCurrentValues().clear();
ParameterFieldDiscreteValue newDiscreteValue = new ParameterFieldDiscreteValue();
newDiscreteValue.setValue("paramValue");
newParameter.getCurrentValues().add(0, newDiscreteValue);
pfController.modify(oldParameter, newParameter);
clientDocument.refreshReportDocument();
PrintOutputController po = clientDocument.getPrintOutputController();
InputStream is = po.export(reportFormat);
Could anyone advise me how to proceed with resolving this error?Thanks for the link. I copied the CrystalReportsSDK.jar and logging.jar from the Crystal Server java\lib directory into my project and revised the code accordingly. Now, a slightly different error occurs at the same place:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Unable to connect to the server: {0}. --- Connection reset by peer: socket write error---- Error code:-2147217387 [CRSDK00000039] Error code name:connectServer
at com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwReportSDKServerException(ReportSDKServerException.java:115)
at com.crystaldecisions.proxy.remoteagent.TCPIPCommunicationAdapter.request(TCPIPCommunicationAdapter.java:659)
at com.crystaldecisions.proxy.remoteagent.AdapterCommunicationChannel.send(AdapterCommunicationChannel.java:88)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.request(ReportAppSession.java:382)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.logon(ReportAppSession.java:342)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(ReportAppSession.java:330)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.initializeServerConnectionAdapter(ClientDocument.java:627)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.initializeServerConnection(ClientDocument.java:658)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.initializeServerConnection(ReportClientDocument.java:1420)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(ClientDocument.java:982)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.open(ReportClientDocument.java:226)
at ourPackage.OurClass.openReport(OurClass.java:97)
The revised code is
ReportClientDocument clientDocument = new ReportClientDocument();
clientDocument.setReportAppServer("172.16.4.154:1566"); // localhost
// Error occurs here
clientDocument.open("D:\\path\\to\\report.rpt", com.crystaldecisions.sdk.occa.report.application.OpenReportOptions.openAsReadOnly.value()); -
How to create a report with data using the Crystal Reports for Java SDK
Hi,
How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats. I can create my own report through the following code snippet:
ReportClientDocument boReportClientDocument = new ReportClientDocument();
boReportClientDocument.newDocument();
However, I cannot find a way to add data elements to the report without specifying an RPT file. Is this possible? I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
is there a way to do this through these packages?
com.crystaldecisions.sdk.occa.report.data
com.crystaldecisions.sdk.occa.report.definition
Am I forced to create a RPT file for the different table and column structures I have?
Thank you in advance for any insights.
Ted JenneyHi Rameez,
After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser. I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
<%
try {
ReportClientDocument rcd = new ReportClientDocument();
rcd.newDocument();
// Setup the DB connection
String database_dll = "Sqlsrv32.dll";
String db = "qa_start_2012";
String dsn = "SQL Server";
String userName = "sa";
String pwd = "sa";
// Create the DB connection
ConnectionInfo oConnectionInfo = new ConnectionInfo();
PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
// Set new table logon properties
PropertyBag oPropertyBag2 = new PropertyBag();
oPropertyBag2.put("DSN", dsn);
oPropertyBag2.put("Data Source", db);
// Set the connection info objects members
// 1. Pass the Logon Properties to the main PropertyBag
// 2. Set the Server Description to the new **System DSN**
oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
oPropertyBag1.put("Database DLL", database_dll);
oConnectionInfo.setAttributes(oPropertyBag1);
oConnectionInfo.setUserName(userName);
oConnectionInfo.setPassword(pwd);
// The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
// Add a Database table
String tableName = "Building";
Table oTable = new Table();
oTable.setName(tableName);
oTable.setConnectionInfo(oConnectionInfo);
rcd.getDatabaseController().addTable(oTable, null);
catch(ReportSDKException RsdkEx) {
out.println(RsdkEx);
catch (Exception ex) {
out.println(ex);
%>
Throws the exception
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
String tableName = "Building";
String fieldname = "Building_Name";
Table oTable = new Table();
oTable.setName(tableName);
oTable.setAlias(tableName);
oTable.setQualifiedName(tableName);
oTable.setDescription(tableName) ;
Fields fields = new Fields();
DBField field = new DBField();
field.setDescription(fieldname);
field.setHeadingText(fieldname);
field.setName(fieldname);
field.setType(FieldValueType.stringField);
field.setLength(40);
fields.add(field);
oTable.setDataFields(fields);
oTable.setConnectionInfo(oConnectionInfo);
rcd.getDatabaseController().addTable(oTable, null);
This code succeeds, but it is not clear how to add that database field to a section. If I attempt to call the following:
FieldObject oFieldObject = new FieldObject();
oFieldObject.setDataSourceName(field.getFormulaForm());
oFieldObject.setFieldValueType(field.getType());
// Now add it to the section
oFieldObject.setLeft(3120);
oFieldObject.setTop(120);
oFieldObject.setWidth(1911);
oFieldObject.setHeight(226);
rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
Then I get an error (which is not unexpected)
com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
How do I add one of the table.SetDataFields() to my report to be displayed?
Are there any other pointers or suggestions you may have?
Thank you
Maybe you are looking for
-
Desktop Widgets (Windows 7/8 and Mac)
I'd like to see a floaty desktop widget or sidebar similar to what's on Android that just shows current song, play, skip, pause, etc without having to launch the full spotify client.
-
LD_LIBRARY_PATH setting for a typical compiler installation
What is the setting of the LD_LIBRARY_PATH environment variables (all three forms, i.e., including the ones with the _32 and _64 suffix) we can expect on a typical Sun C++ installation on SPARC? Can we expect only LD_LIBRARY_PATH to be set or do the
-
I have a mini that used to have tiger on it, i tried upgrading to leopard but the disk was no good and wiped everything off. now i have a legit copy of leopard and when i put in the disk and hold down c all i get is the gray apple screen how long sho
-
What do I do if my Logic Studio Serial number was stolen, box and all?
So, my box for Logic Studio that I've had since 2010 was stolen, as well as my old computer...and external hardrive where the serial number was backed up. Can apple verify it is me via email, social security, anything, or am I just kind of screwed, a
-
Setting content (Java parser)
Hi, I'm using a Java parser to take in binary files. In windows explorer if I drag and drop on to an ifs it works fine, however if the file already exists then it is replaced by a 0 byte file of the same name. Heres the relevant parser code: public L