Passing a date range to a Crystal Report using OpenDocument
Hi,
I am trying to call up a Crystal report in InfoView using a hyperlink with the OpenDocument function call.
It is working fine with the following URL:
http://<server name>:<port>/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=ARcnOcErTA1FidjRJ_sT0Yw&sType=rpt&sRefresh=Y&lsSCompany+Code=1300&lsMCost+Center=[12345],[67890]&lsSCost+Element=0000100123
However, once I added the date range into the parameter string, like this:
http://<server name>:<port>/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=ARcnOcErTA1FidjRJ_sT0Yw&sType=rpt&sRefresh=Y&lsSCompany+Code=1300&lsMCost+Center=[12345],[67890]&lsSCost+Element=0000100123&lsRFiscal+Year+Period=[Date(1,1,2011)..Date(1,9,2011)]
It returns an error message, "An error has occurred: java.util.Date ", to my browser.
I am wondering if I am missing any Java library or Java class path.
Any thoughts are appreciated.
Joyce
Edited by: Joyce Chan on Aug 30, 2011 12:25 PM
How do I check if the parameter passing in is in date type?
the following is exactly what I've tried:
&lsRFiscal+Year+Period=[Date(2010,10,10)..Date(2010,10,15)]
Would the error message be logged in the server, maybe I can find more information for the error log?
Similar Messages
-
How to pass database login information to a crystal report using c#?
Hi,
I need to pass database logon information to a crystal report dynamically using c#. I am developing a windows application using c# .Net.
I looked some of the articles however I am not able to figure out the mistake I have did. Please find below the code I have written so far; It would be great if you could help me out in solving the issue.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using System.Configuration;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
private void Frm_report_Load(object sender, EventArgs e)
setReportParameters(); // method to pass parameters to the Crystal report
crystalReportViewer1.ReportSource = new Upper_Lower(); // Upper_Lower is the Crystal report I have used in my project
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables crTables;
crTables = new Upper_Lower().Database.Tables;
crConnectionInfo.ServerName = "oops";
crConnectionInfo.DatabaseName = "";
crConnectionInfo.UserID = "new";
crConnectionInfo.Password = "new123";
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crTables)
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
Thanks & Regards,
Karthik.Hi,
Try using this code ,
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("Report name"));
rd.SetDatabaseLogon("User Name", "Password", "Server Name", "Database Name");
CrystalReportViewer1.ReportSource = rd;
[See Also.|http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm]
Hope this helps!!
Sincerely,
Nikhil Dharme -
Possible to pass a date range to a subreport?
Hi,
I've created a report with three groups and I suppress the second and third group. The first group displays a summary of the details. If I "hide" the details I have a nice summary looking report which I can then click on to drill down into the details. However, I cannot enable the "hide" functionality because of two reasons: 1. I'm using the crystal java viewer and it has serious limitations when using the hide/drill-down feature; and 2. in order to print I have to click on each group item in order to print - so when I have 20 values in my group I'm going into each group 20 times and printing 20 times.
So, I still want a summary view of all my group summaries at the front of my report. How can I consolidate the group values into a single summary view? I attempted creating a subreport that is the same as the main report however the issue is that the initial parameter used is a date *range". I'd like to pass the date range to the subreport and then I'm sure this would all work. Does crystal support passing a date range to a sub-report? If so, how is this done?
thx!
MarkHi Mark,
Yes, you can pass a date range value to the SUbreport!
Here's how its done:
1) Create a formula in the Main report; call it Start_date:
Minimum({?Date_parameter})
2) Create a second formula in the Main report and call it End_date:
Maximum({?Date_parameter})
3) Insert the sub-report and then Right-click the sub-report > Select Change Subreport links > Move the Start_date and End_date formulas to 'Fields to Link to' area and make sure you uncheck the 'Select data in subreport based on field' option.
4) Edit the sub-report (Right-click > Edit) and insert a Record Selection formula to include the parameters from the Main Report.
Go to Report > Selection Formulas > Record:
{date_field} >= {?Pm-@Start_date} and {date_field} <= {?Pm-@End_date}
Hope this helps!
-Abhilash -
Date range query problem in report
Hi all,
I have created a report based on query and i want to put date range selection but query giving problem.
If i am creating select list selection then it is working fine means it will display all records on the particular date.
But what i need is that user will enter date range as creation_date1,creation_date2 and query should return all the records between these date range. i want to pass it by creating items, i created two items and passing creation_date range to display all records but not displaying and if not passing date then should take null as default and display all records
Here is the query:
/* Formatted on 2006/12/10 20:01 (Formatter Plus v4.8.0) */
SELECT tsh."SR_HEADER_ID", tsh."SALES_DEPT_NUMBER", tsh."COUNTRY",
tsh."LOCAL_REPORT_NUMBER", tsh."ISSUE_DATE", tsh."SUBJECT",
tsh."MACHINE_SERIAL_NUMBER", tsh."MACHINE_TYPE", tsh."MACHINE_HOURS",
tsh."STATUS"
FROM "TRX_SR_HEADERS" tsh, "TRX_SR_PARTS" tsp
WHERE (tsh.status LIKE :p23_status_sp OR tsh.status IS NULL)
AND (tsh.machine_type LIKE :p23_machine_type_sp)
AND ( tsh.machine_serial_number LIKE
TO_CHAR (:p23_machine_serial_number_sp)
OR tsh.machine_serial_number IS NULL
AND ( TO_CHAR (tsh.failure_date, 'DD-MON-YY') LIKE
TO_CHAR (:p23_failure_date_sp)
OR TO_CHAR (tsh.failure_date, 'DD-MON-YY') IS NULL
AND ( TO_CHAR (tsh.creation_date, 'DD-MON-YY')
BETWEEN TO_CHAR (:p23_creation_date_sp)
AND TO_CHAR (:p23_creation_date_sp1)
OR TO_CHAR (tsh.creation_date, 'DD-MON-YY') IS NULL
AND (tsh.issue_date LIKE :p23_date_of_issue_sp OR tsh.issue_date IS NULL)
AND (tsh.country LIKE :p23_country_sp OR tsh.country IS NULL)
AND ( tsh.local_report_number LIKE TO_CHAR (:p23_local_rep_num_sp)
OR tsh.local_report_number IS NULL
AND ( tsp.part_number LIKE TO_CHAR (:p23_part_number_sp)
OR tsp.part_number IS NULL
AND tsh.machine_type IN (
SELECT DISTINCT machine_type
FROM trx_sales_dept_machine_list
WHERE sales_department_id IN (
SELECT DISTINCT sales_department_id
FROM trx_user_sales_department
WHERE UPPER (user_name) =
UPPER ('&APP_USER.'))
AND SYSDATE >= valid_from)
AND tsh.sr_header_id = tsp.sr_header_id
can any one tell me wat is wroung in this query.
Any other way to write this?
Thank You,
AmitHi User....
Here is some date range SQL that my teams uses with some success:
For date columns that do not contain NULL values, try this (note the TRUNC, it might help with your "today" problem).
The hard coded dates allow users to leave the FROM and TO dates blank and still get sensible results (ie a blank TO date field asks for all dates in the future.
AND TRUNC(DATE_IN_DATABASE)
BETWEEN
decode( :P1_DATE_FROM,
TO_DATE('01-JAN-1900'),
:P1_DATE_FROM)
AND
decode( :P1_DATE_TO,
TO_DATE('31-DEC-3000'),:
:P1_DATE_TO)
For date columns that contain NULL values, try this (a little bit trickier):
AND nvl(TRUNC(DATE_IN_DATABASE),
decode( :P1_DATE_FROM,
decode( :P1_DATE_TO,
TO_DATE('30-DEC-3000'),
NULL),
NULL)
BETWEEN
decode( :P1_DATE_FROM,
TO_DATE('01-JAN-1900'),
:P1_DATE_FROM)
AND
decode( :P1_DATE_TO,
TO_DATE('31-DEC-3000'),
:P1_DATE_TO)
Note the 30-DEC-3000 versus 31-DEC-3000. This trick returns the NULL dates when the FROM and TO date range items are both blank.
I hope this helps.
By the way, does anyone have a better way of doing this? The requirement is given a date column in a database and a FROM and a TO date item on a page,
find all of the dates in the database between the FROM and TO dates. If the FROM date is blank, assume the user want all dates in the past (excluding NULL dates). If the TO date is blank, assume that the user wants all of the dates in the future (excluding NULL dates). If both FROM and TO dates are blank, return all of the dates in the databse (including NULL dates).
Cheers,
Patrick -
Hello Experts,
I want to include a range value in crystal report. Currently the report is used for printing AR invoice with one invoice at time, wherein user inputs invoice number which he wants to print. I want to include invoice number range in the report, but that option is disabled in the parameter field. In present report Invoice number is taken as static value and then connected to db to get the data of that AR invoice number, advise how to
- Activate "Allow Range Value option"
- How to set up the multiple invoice printing
Setup details : SBO 2007B, CR 2008, SQL 2005
Regards
DeepakHi Deepak........
Sure........
Hope your query report is perfect and for Parameter Range goto Report Expert in Tool Bar of the Crystal Report you can find it by yellow coloured Flask Symbol. Click on that and just define the range of parameters........
Regards,
Rahul -
Trying to change the data source for a Crystal Report.
<p>The method below represents my best attempt to programatically change the data source of a Crystal Report. The goal is to have a routine that will update the data source for reports after they have been distributed to production servers. So far I have not been successful in saving the report back to the CMS. No exceptions are thrown, but when I view the Database Configuration of the report in the CMC nothing has changed.
</p>
<p>
Am I missing a step, or is there another way to accomplish this?
</p>
<p>
Thank you.
</p>
<hr />
<pre>
private void test(String reportName)
throws SDKException, ReportSDKException, java.io.IOException
IInfoObjects newInfoObjects;
IInfoObject reportObj;
ReportClientDocument clientDoc = new ReportClientDocument();
DatabaseController dc;
PropertyBag pBag;
PropertyBag logonProps;
ConnectionInfo newConInfo;
ConnectionInfo oldConInfo;
ConnectionInfos conInfos;
int connOptions = DBOptions._ignoreCurrentTableQualifiers + DBOptions._doNotVerifyDB; //0;
Fields connFields = null;
String queryStr = "Select * From CI_INFOOBJECTS " +
"Where SI_NAME='wfr.rpt' AND SI_KIND='CrystalReport' AND SI_INSTANCE=0";
newInfoObjects = getCms().executeQuery(queryStr);
if(newInfoObjects.size() > 0)
reportObj = (IInfoObject)newInfoObjects.get(0);
try
clientDoc = getCms().getReportAppFactory().openDocument(
reportObj
, OpenReportOptions._refreshRepositoryObjects
, java.util.Locale.US);
dc = clientDoc.getDatabaseController();
conInfos = dc.getConnectionInfos(null);
for(int i = 0; i < conInfos.size(); ++i)
oldConInfo = (ConnectionInfo)conInfos.getConnectionInfo(i);
newConInfo = (ConnectionInfo)oldConInfo.clone(true);
pBag = newConInfo.getAttributes();
pBag.putStringValue("QE_ServerDescription", "alio");
logonProps = new PropertyBag();
logonProps.putStringValue("Trusted_Connection", "false");
logonProps.putStringValue("Server", "alio");
pBag.put("QE_LogonProperties", logonProps);
newConInfo.setUserName("admin");
newConInfo.setPassword("password");
dc.replaceConnection(
oldConInfo
, newConInfo
, connFields
, connOptions);
catch(ReportSDKServerException Ex)
String msg = "A server error occured while processing the " + reportObj.getKind()
+ " object, " + reportObj.getTitle() + " (" + reportObj.getCUID() + "), from the CMS.";
Utility.errorOut(msg, Ex);
catch(Exception Ex)
String msg = "An error occured while processing the " + reportObj.getKind()
+ " object, " + reportObj.getTitle() + " (" + reportObj.getCUID() + "), from the CMS.";
Utility.errorOut(msg, Ex);
finally
clientDoc.save();
getCms().commitToInfoStore(newInfoObjects);
clientDoc.close();
</pre>
Edited by: Mark Young on Sep 10, 2009 2:16 PM<style type="text/css">
/<![CDATA[/
body
font-size: 1.125em;
font-family: helvetica,arial,"sans-serif";
.code{font-family: "courier new",courier,mono,monospace}
.bi{font-style: italic; font-weight: bold;}
/]]>/
</style>
<p>Justin,</p>
<p>
Thank you for the reply. Time constraints have not allowed me to post back to this tread
till now. I will try your suggestion. My assumption is that <i>Save the report back to the
info store</i> refers to <span class="code">IInfoStore.commit(IInfoObjects)</span>.
</p>
<p>
I'm afraid that I do not understand why I don't want to change the report client document,
or why <i>successfully exporting the report with the new login/password</i> is not what I
want to do. Any explanation on that statement would be appreciated.
</p>
<p>
I did find a way to accomplish my goal. It involved adding the SSOKEY property to the
logon property bag. Below you'll see my revised code which modifies the report logon and
server. I have no idea what
this does, and SAP support has not been able to tell me why it works. However, what I
discovered is that if I changed the report option, <b>Database Configuration -> When
viewing report:</b>, in the CMS to <span class="bi">Use same database logon as when report
is run</span> from <span class="bi">Prompt the user for database logon</span>, then the
SSOKEY property had been added to the logon property bag having an empty string as its
value. This allowed me to successfullyupdate and save the modified logon back to the CMS.
</p>
<p>
So I took a chance and added code to always add the SSOKEY property with an empty string
as its value, and I could then successfully modify and save the report's logon info
and server. Again, I don't know what this means, but it has worked so far. If anyone has
some insight or comments, either are welcome. Thank you in advance.
</p>
<br />
<hr />
<pre>
private void changeDataSourceOfAWFCrystalReports()
throws SDKException, ReportSDKException, java.io.IOException
IInfoObjects newInfoObjects = null;
IInfoObject reportObj = null;
IReport curReport = null;
ReportClientDocument clientDoc = new ReportClientDocument();
DatabaseController dbController;
PropertyBag pBag;
PropertyBag logonProps;
ConnectionInfo newConInfo;
ConnectionInfo oldConInfo;
ConnectionInfos conInfos;
int connOptions = DBOptions._ignoreCurrentTableQualifiers + DBOptions._doNotVerifyDB;
Fields connFields = null;
String outputStr;
int numOfReports;
int numOfQueryPages;
double progressIncrementPerPage = 30;
int progressIncrementPerReport = 0;
// Path query to reports is in a .properties file.
String queryStr = getAppSettingsFile().getWscAwfCrystalReportPathQuery();
try
// Executes IInfoStore.getPageingQuery() and generates a list of queries.
getCms().setPathQueryQueries(queryStr, 100);
numOfQueryPages = 0;
// Gets a List<String> of the IPageResult returned from IInfoStore.getPageingQuery().
if(getCms().getPathQueryQueries() != null)
numOfQueryPages = getCms().getPathQueryQueries().size();
if(numOfQueryPages > 0)
// Use 30% of progress bar for the following loop.
progressIncrementPerPage = Math.floor(30.0/(double)numOfQueryPages);
for(int queryPageIndex = 0; queryPageIndex < numOfQueryPages; ++queryPageIndex)
// Gets the IInfoObjects returned from the current page query
newInfoObjects = getCms().getPathQueryResultSetPage(queryPageIndex);
numOfReports = newInfoObjects.size();
if(newInfoObjects != null && numOfReports > 0)
progressIncrementPerReport =
Math.round((float)Math.floor(progressIncrementPerPage/(double)numOfReports));
for(int reportIndex = 0; reportIndex < numOfReports; ++reportIndex)
reportObj = (IInfoObject)newInfoObjects.get(reportIndex);
curReport = (IReport)reportObj;
clientDoc = getCms().getReportAppFactory().openDocument(
reportObj
, OpenReportOptions._refreshRepositoryObjects
, java.util.Locale.US);
dbController = clientDoc.getDatabaseController();
conInfos = dbController.getConnectionInfos(null);
for(int conInfosIndex = 0; conInfosIndex < conInfos.size(); ++conInfosIndex)
oldConInfo = (ConnectionInfo)conInfos.getConnectionInfo(conInfosIndex);
newConInfo = (ConnectionInfo)oldConInfo.clone(true);
pBag = newConInfo.getAttributes();
pBag.putStringValue(
"QE_ServerDescription"
,getConfigFile().getDBDataSourceConnections());
logonProps = new PropertyBag();
logonProps.putStringValue("Trusted_Connection", "false");
<b>logonProps.putStringValue("SSOKEY", "");</b>
logonProps.putStringValue(
"Server"
,getConfigFile().getDBDataSourceConnections());
pBag.put("QE_LogonProperties", logonProps);
newConInfo.setUserName(getConfigFile().getUNVConnectionUserName());
newConInfo.setPassword(getConfigFile().getUNVConnectionPasswordDecrypted());
dbController.replaceConnection(
oldConInfo
, newConInfo
, connFields
, connOptions);
newConInfo = (ConnectionInfo)conInfos.getConnectionInfo(conInfosIndex);
} // end for on conInfosIndex
clientDoc.save();
} // end for on reportIndex
} // end if on newInfoObjects
} // end for on queryPageIndex
} // end try
catch(ReportSDKServerException Ex)
// handle...
catch(Exception Ex)
// handle...
finally
getCms().commitToInfoStore(newInfoObjects);
if(clientDoc != null)
clientDoc.close();
</pre> -
XML and Web Service Data Source Missing in Crystal Reports for VS
I would like to use a Web Service as the data source for a Crystal Report that will be running outside of my Visual Studio application. So setting the data source to the web service in code is not possible. My understanding is Crystal Reports has a connection (in the Database Expert under New Connection) named XML and Web Service. Here you can select web service and enter the WSDL URL for the web service. However it does not appear in the list for Crystal Reports for Visual Studio. Does this connection type come with the Visual Studio version of Crystal Reports and if not is their a way to obtain it?
Thank you for your assistance.None of the bundled versions of CR have the driver. Reason is that the driver responsible for these connections requires the Java framework and I suspect MS would not be too pleased if we installed the Java framework. The stand alone versions, since they are not part of any bundle can and do install the Java framework and the driver. Note that even the latest release of CR - CRVS2010 does not have the driver as it essentially becomes a bundle or a VS2010 plug-in.
So, the short of it is; you have to obtain a stand-alone version of CR. I'd recommend CR 2008 (12.x) as CRXI R2 will run out of support in June of this year.
- Ludek -
MDM ABAP API query to pass the date range
Hi
I want to retrieve certain data from MDM repository based on filter criteria by date stamp.
Not sure how to do it to pass the select option value in the query.
select-options: s_cdate for sy-datum obligatory .
DATA wa_query TYPE mdm_query.
DATA: v_search_date1 TYPE MDM_CDT_DATE_TIME.
data: v_datestamplow1 type string.
data: v_datestamplow type TZNTSTMPL.
concatenate s_cdate-low '000000' into v_datestamplow1
v_datestamplow = v_datestamplow1.
clear wa_query.
wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
wa_query-operator = 'EQ'.
wa_query-dimension_type = mdmif_search_dim_field. "Field search
wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
I am able to get the data when I just pass the low value from selecct option. But I dont how to pass the date range.
v_search_date1-CONTENT = v_datestamplow.
ET REFERENCE OF v_search_date1 INTO wa_query-value_low.
APPEND wa_query TO gt_query.
CALL METHOD cl_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'Vendors'
it_query = gt_query
IMPORTING
et_result_set = gt_result.
II could see the below operator types . Although EQ says "Like standard select-options parameter" not sure how to pass the value.
EQ Equal to (like standard select-options parameter)
NE Not equal to (like standard select-options parameter)
LT Less than (like standard select-options parameter)
LE Less than or equal to (like standard s-o parameter)
GT Greater than (like standard select-options parameter)
GE Greater than or equal to (like standard s-o parameter
SW Starts with (MDM specific parameter)
Thanks,
Krishna.Hi,
To get the date range for select options, pass the low value with 'GE' operator and another query option with 'LE' operator for high value.
select-options: s_cdate for sy-datum obligatory .
DATA wa_query TYPE mdm_query.
DATA: v_search_date1 TYPE MDM_CDT_DATE_TIME.
data: v_datestamplow1 type string.
data: v_datestamplow type TZNTSTMPL.
concatenate s_cdate-low '000000' into v_datestamplow1
v_datestamplow = v_datestamplow1.
clear wa_query.
wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
wa_query-operator = 'GE'.
wa_query-dimension_type = mdmif_search_dim_field. "Field search
wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
GET REFERENCE OF v_search_date1 INTO wa_query-value_low.
APPEND wa_query TO gt_query.
concatenate s_cdate-high '235959' into v_datestamphigh1
v_search_date2 = v_datestamphigh1.
clear wa_query.
wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
wa_query-operator = 'LE'.
wa_query-dimension_type = mdmif_search_dim_field. "Field search
wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
GET REFERENCE OF v_search_date2 INTO wa_query-value_low.
APPEND wa_query TO gt_query.
CALL METHOD cl_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'Vendors'
it_query = gt_query
IMPORTING
et_result_set = gt_result.
Thanks. -
Optional Prompt for Date type parameter in Crystal Report.
Hi Every One,
I have a date type parameter in crystal report.When I am convert it to optional prompt it is showing following message.
But the Type field is gray out when I was selecting list of values Dynamic.
Please suggest.
Thanks and Regards
DEVHi,
Please check SAP note:
1710595 - CR_Defining "Optional Prompt" as True for SAP Crystal
Reports Does Not Work
Thanks & Regards,
Nagarajan -
Passing the Date range within the query
Hi ,
In my query , I have two date characteristic, and while doing the selection I have to do selection on only one date field.
This selection is a date range selection , So I have used a selection variable for this.
Can anyone please let me know if it is possible to pass the selection range to other variable. Is it possible to use Customer exit to pass the complete range.
Thanks
AltairHi,
You can do it in the user exit.And that is the only approach to transfer the values of one variable to other variable .
Search this forum for the code. you will find lot of postings.
With rgds,
Anil Kumar Sharma .P -
Print a report in crystal Report using SDK
Hi Dear;
any body can publish a sample code how can i print a report built in crystal report using SDK?
regards;Hi Dany,
Hope the following code will help u .
before calling the function make a XML by using dataset.writexml, in which you have to pass the name of your stored procedure.
for this you have to decalre commantype as stored procedure.
first parameter of this is rpt name . asecon paramer is ur xml name which you got from DAtaset.writexml.
Sub ShowReport(ByVal rptName As String, ByVal SourceXML As String)
Try
Dim oSubReport As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim rptSubReportDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim rptView As New CrystalDecisions.Windows.Forms.CrystalReportViewer
Dim rptPath As String = System.Windows.Forms.Application.StartupPath & "\" & rptName
Dim rptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDoc.Load(rptPath)
For Each oMainReportTable As CrystalDecisions.CrystalReports.Engine.Table In rptDoc.Database.Tables
oMainReportTable.Location = System.Windows.Forms.Application.StartupPath & "\" & SourceXML
Next
For Each rptSection As CrystalDecisions.CrystalReports.Engine.Section In rptDoc.ReportDefinition.Sections
For Each rptObject As CrystalDecisions.CrystalReports.Engine.ReportObject In rptSection.ReportObjects
If rptObject.Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
oSubReport = rptObject
rptSubReportDoc = oSubReport.OpenSubreport(oSubReport.SubreportName)
For Each oSubTable As CrystalDecisions.CrystalReports.Engine.Table In rptSubReportDoc.Database.Tables
oSubTable.Location = System.Windows.Forms.Application.StartupPath & "\" & SourceXML
Next
End If
Next
Next
rptView.ReportSource = rptDoc
rptView.Show()
Dim oFrm As New System.Windows.Forms.Form
rptView.DisplayGroupTree = False
rptView.Dock = System.Windows.Forms.DockStyle.Fill
rptView.Location = New System.Drawing.Point(0, 0)
oFrm.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
oFrm.Controls.Add(rptView)
oFrm.Name = "rptForm"
oFrm.Text = "rptForm"
oFrm.ResumeLayout(False)
oFrm.WindowState = System.Windows.Forms.FormWindowState.Maximized
oFrm.TopMost = True
oFrm.ShowDialog()
Catch ex As Exception
oApplication.MessageBox(ex.Message)
End Try
End Sub -
Creating a crystal report using excel
I have an excel spreadsheet that I would like to access to create a crystal reports. But it seems that I have to first save it as an access or other database file. But this information changes frequently so I it would be more efficient to access the excel file directly. I tried using the crystal wizard addin in excel, but then when I run the report I get the error message "Server has not yet been opened". Any other ideas on how to create report of excel data directly?
Hello Guys ,
I have something similar problem ,but not exactly.
our requirement is We are scheduling one crystal report to generate excel and sent to FTP location.This Excel file (in FTP) should be the input of new Crystal Report using ODBC (RDO) connection.
I am able to create the ODBC connection,but that ODBC connection is not showing me the selected excel sheet in the Crystal Report ODBC Connection.I tried with Remote as well as local drive Excel also.
I tried on different machine (thought ,it could be Driver specific),but all machines does have same issue.
Is there any settings or driver upgrades require for CR XI R2 /2008 in order to use ODBC (RDO) for EXCEL FILES.I didnt find any comments /resolution in Google too.
My steps -
1) Create a sample Excel file - only few records
2) Created a System ODBC connection pointing this excel file say "TEST1"
3) Opened A Blank Crystal Report
4) Create a New connection
5) Select ODBC RDO
6) Create new connection and selected the newly created SYSTEM DSN "TEST1"
7) check the selected excel is displayed in ODBC RDO connection??
If it is a Crystal Report issue or ODBC Driver issue ,please let me know if anyone have came across similar issues.
thanks in advance.
Nitin -
How do you reference a Formular Object on a Crystal Report using Java
Hi all,
I am trying to reference an object on my report which contains a Formula field.
I have read the following 2 threads, but they refer to textObjects:
[How do you reference a textObject on a Crystal report using Java|Re: How do you reference a textObject on a Crystal report using Java?]
[Changing the text of ITextObject programatically|Re: Changing the text of ITextObject programatically]
But I cannot even get those to work. I can reference a object which refers to a database field but as soon as I try
reference a textObject or reportObject I just get a NULL variable.
Below is the code I am useing
IReportObject dbField = reportClientDocument.getReportDefController().findObjectByName("BOB1");
IReportObject textBob = reportClientDocument.getReportDefController().findObjectByName("BOB2");
"BOB1" is the name of my DB field Object, and "BOB2" can be a Text box or a Formula item and I just get nothing.
I have just tested it with a FieldHeadingObject and that returns a valid object, so clearly I am going about this the wrong way
for objects I place on the reports which are not driven by the database items.
Ultimately what I want to do is reference an object in the Report Footer which will contain the RecordCount of the number of
records contained in the report, which I am them going to use to determine if the report holds data,
if it does I will print it, else ignore it and move on the the next report. I am doing this so that I can at an extra filter to split
a report up into groups and produce a sinlge PDF for each group instead of one massive PDF containing all the groups.
So if someone has a solution to any of my problems I would be very greatful, and I dont mind being told Im an idiot and should
rather do it another way, as long as you supply that other way
Thanks for the help
Darren
Edited by: Darren Jackson on Dec 16, 2009 7:29 PM
Forgot to add am using CR4Ev2 SP3Right I have made some headway.
Firstly, Im an idiot. I was making changes and setting up test fields on my report, but then when running the app, I had it looking at
the backup report, which would explain why all the new textbox fields were not being found.
The stupiditity did force me to delve deep and work out a fair bit of how the reports work, so cant complain too much. BUT, I am still
not able to return values of Formula fields and formulas extra. Could someone tell me if this is even possible. I get retrieve the formula field
name, and properties but not its value once the report has been populated. Am I wasting my time?
Well I will continue dismantling my reports till I find the answer, or someone points me in the right direction.
If any one is interested this is the code I used to drill down to my text boxes:
IReportObject recCount = reportClientDocument.getReportDefController().findObjectByName("TB1");
ITextObject obj_RecCount = (ITextObject) recCount;
System.out.println(obj_RecCount.getName());
Paragraphs objP = obj_RecCount.getParagraphs();
for (int i = 0; i < objP.size(); i++){
ParagraphElements pE = objP.getParagraph(i).getParagraphElements();
for (int j = 0;j < pE.size(); j++){
IParagraphTextElement pEE = (ParagraphTextElement) pE.getParagraphElement(j);
System.out.println(pEE.getText());
Cheers -
Crystal reports using xml at run time??
Post Author: avnkkishore
CA Forum: General
Hi,
I have very simple requirement.
I would like to create a crystal
report using XML. This
XML file will be decided at run time
(not at design time).
Hence i have added a crystal report viewer control to my windows form and did
not choose any data source (i left it blank currently). Now i am trying to load
XML file with the following simple code.
PropertyBag
crLogOnDetails = new PropertyBag();
crLogOnDetails["Local XML File"] = @"C:\Hosts.xml";
crLogOnDetails["Local Schema File"] = @"C:\Hosts.xsd";
ConnectionInfo conn = new ConnectionInfo();
conn.Attributes = crLogOnDetails;
// create
"Host" table
CrystalDecisions.ReportAppServer.DataDefModel.Table tbl;
tbl = new
CrystalDecisions.ReportAppServer.DataDefModel.Table();
tbl.Name =
"Host";
tbl.ConnectionInfo = conn;
rcDoc.DatabaseController.AddTable(tbl, null);
I am getting exception exactly at the above line (i.e. when adding table to
Database Controller) saying "COMException was unhandled" with error code
0x80004005 Unspecified error.
Can any one please help me regarding how to resolve this.
Thanks in advance,
KishoreI am using VB6 as the front end and Microsoft Access to hold the data and Crystal Reports 8.5. I have a staff name parameter that I want the user to select which staff name to print the report. If there is
a new staff the name is not in the list of parameters. How do I add to the parameter list at run time from the staff table?
Hi,
I am afraid that these forums don't support VB6, you could refer to this thread:
Where to post your VB 6 questions
You could consider posting this issue in these forums below:
These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
VB Forums
VB City
In addition, issues related to Crystal Reports are not supported either since it belongs to third-party.
You could post issues related to Crystal Reports to its forum to get dedicated supports.
SAP Crystal Reports for .NET forum:
http://forums.sdn.sap.com/forum.jspa?forumID=313
Thanks for your understanding.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Problem in Display the Crystal report using Crystal report Viewer 2008
Hi All,
I have developed crystal web project with crystal report using Eclipse IDE. when I deploy this web application using Tomcat server 6.0 in Windows xp, Windows Vista.. It is working fine..
But When I deploy it into Windows 2000 server , I am not able to see Last 2 columns of the report page in the Viewer.
But When I tried to Export as Excel, I got all the datas in the Report and also when I preview the report in Eclispe IDE using crystal viewer plugin it is working fine in Windows 2000 server also..
Thanks in Advance for your help..
Regards,
SathiyaMBPSWindows 2000 is not supported in current versions of CR. Check the platforms PDF file.
Maybe you are looking for
-
We are using Oracle DB and OAS 10g. OAS is installed on a Windows2K server, with the Infrastructure and Portal instances. We created a new OC4J instance in the Infrastructure, and have deployed an EJB application to this instance. The port assigned f
-
Feature Request: Zoom from cursor position
Default zoom behavior seems to be to zoom with the zoom center at the center of the screen. This works sort of OK. However, it would be more efficient for me if I could zoom with the zoom center at the cursor/mouse position. Then I can quickly zoom i
-
I have a site which is days from launching in which I have encountered a problem. The home page of this site contains a scrollbar on one of the css containers only when viewed in IE7. This project was started in GoLive CS2 and then migrated to Dreamw
-
What's the Point of Photo Stream?
What is the point of having the option to turn on or off the photo stream if it no longer exists? If it has been replaced by the recent activity feature then why not have the option to turn on or off the recent activity feature?
-
Make my own template for a one page book?
I need to make a book template that will appear in the list of possible book designs -- is that possible? Secondly -- I want to make a one-page book (call it a poster if you want) it's really a form that I want to print out with a different photo eac