Thursday, March 22, 2012
Easy but Im new...
So I'm only a beginner at Crystal but here it goes: I am writing a report for the Helpdesk that tells them the amount of issues they need to escalate out of their group. I had to do a TrimRight({Column}20 to 35) and also added a TRIM to cut out any leading or ending spaces.
This part worked great, exactly what I needed, but now I need to match that value from the formula with a column in a database. The value gives me back a login name such as TBARLOW. I now need to match that value to the loginid column and see if it matches anything in that column.
IF {@.Trim} = {Support_Staff.Login ID} then
{Incident_Details.From Group:}
There are no errors in the formula...so basically I need it to say: take @.trim and find that value in the {Support_Staff.Login ID} field.
Any help would be great,
Thanks so much,
Timwell 2 things - do you know if {Support_Staff.Login ID} has any leading or ending spaces? As common practice (espcecially if comparing) I always use TRIM on each field. I.E.
If {@.Trim} = trim({Support_Staff.Login ID}) then ...
the second thing - and maybe this is just a typo - Is {Support_Staff.Login ID} supposed to be {Support_Staff.LoginID} or maybe {Support_Staff.Login_ID}? If you just double clicked on the field in the Report Fields, then it should be right, if you just typed it in thought there might be a problem. As far as I know, most databases don't like spaces in the field names.sql
Wednesday, March 21, 2012
Dynamicalt changing sql query in crystal sub report
i had make sql change in main report
but
How to make to send a SQL request for the subreport ?
IreshMoved to a more proper forum|||Open the subreport and change the query that you want
Monday, March 19, 2012
Dynamically send query to report
can we use our own SQL queries to display records in the report?
if report contains the Group field.
Can we do this in Crystal Report 8.5
and SQL server 2000
Thanks in Advance
Regards
Henry JonesYes u can
First of all tell me the Client side application techn... u r using
whether classic VB6 / VS2003
and u r requirement is bit unclear can u illustrate more on it
FaFa|||Make use of SQLQuery feauture
Dynamically Passing a Dataset to a Report in Reporting Services 2005
Could someone please tell how this scenario can be achieved using VB.Net 2005 and Reporting Services.
Thank you, in advance.
The equivalent of doing this in SSRS-land is to use the VS 2005 Report Viewer contorl in local mode (the report is processed at the client, not on the SSRS server), provide it with the RDL for the report (called RDLC), and "marry" a dataset to the datasource of the control. You'll find examples of same in books online and out on gotreportviewer.com
Sunday, March 11, 2012
Dynamically creating SQL Server Report
I've been working with Crystal Reports for a couple of months and I'm now interested in creating a SQL Server Report but need assistance. With CR I'm able to point a report to a dataset within the application and then modify the dataset by passing parameters from the web page that hosts the crystalreportviewer. The CR then reflects the updated dataset. I'm looking to create the same functionality with SQL Server Reports but I'm unfamiliar. Below is the code I use for one of my reports called 'Holds'. Any assistance is appreciated!
Holds.aspx
<form id="form1" runat="server">
<div class="rptParameters">
<table cellpadding="0" cellspacing="0" border="0">
<tr align="left" valign="middle">
<td>
Season:
</td>
<td>
<asp:DropDownList ID="ddlSeason" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSeason_SelectedIndexChanged">
<asp:ListItem Value="" Text=""></asp:ListItem>
<asp:ListItem Value="MC0607" Text="MC0607"></asp:ListItem>
<asp:ListItem Value="MC0708" Text="MC0708"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</div>
<asp:Panel ID="rptPanel" runat="server" CssClass="rptViewer" Visible="false">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
HasCrystalLogo="False" EnableDrillDown="False" />
</asp:Panel>
</form>
Holds.aspx.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Web;public partialclass Holds : System.Web.UI.Page
{
private ReportDocument myReport;// Handles initial page loadprotected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["Season"] =null;
}if (Session["Season"] !=null)
{ConfigureCrystalReports();
}}
// Handles configuring crystal reportsprivate void ConfigureCrystalReports()
{
myReport =new ReportDocument();
string reportPath = Server.MapPath("reports/Holds.rpt");
myReport.Load(reportPath);
DataSet dataSet = DataSetConfiguration.Holds;
myReport.SetDataSource(dataSet);
CrystalReportViewer1.ReportSource = myReport;
}// Handles season dropdownlist selectedIndexChangedprotected void ddlSeason_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlSeason.SelectedIndex == 0)
{
Session["Season"] =null;
}
else
{
Session["Season"] = ddlSeason.SelectedValue;
ConfigureCrystalReports();
}
}
}
DataSetConfiguration.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;/// <summary>
/// Summary description for DataSetConfiguration
/// </summary>public class DataSetConfiguration
{
public DataSetConfiguration()
{
//
// TODO: Add constructor logic here
// }// Handles creating holds datasetpublic static DataSet Holds
{
get {// get parametersstring SEASON = System.Web.HttpContext.Current.Session["Season"].ToString();
string TK_EVENT_STATUS ="TK_EVENT_" + SEASON +"_STATUS";
string TK_EVENT ="TK_EVENT_" + SEASON;DataSet dataSet =new DataSet();
string query ="SELECT TOP 100 PERCENT A.[STATUS], '" + SEASON +"' AS [SEASON], C.NAME AS [DESC]," +
" A.[Z_ID] AS [EVENT], A.[NSTATUS], B.[NAME], B.[DATE], B.[TIME]" +
" FROM " + TK_EVENT_STATUS +" A LEFT OUTER JOIN" +
" " + TK_EVENT +" B ON A.Z_ID = B.Z_ID LEFT OUTER JOIN" +
" TK_SEAT_STATUS C ON A.STATUS = C.STATUS COLLATE SQL_Latin1_General_CP1_CS_AS" +
" WHERE (A.Z_ID NOT LIKE '%P') AND (A.Z_ID NOT LIKE 'W%')" +
" AND (A.STATUS <> 'O') ORDER BY B.[DATE], B.[TIME], B.[NAME]";dataSet.ReadXmlSchema(@."D:\Web Sites\Holds\App_Code\HoldsDataSet.xsd"); SqlConnection conn =new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString);
SqlDataAdapter cmd =new SqlDataAdapter(query, conn);cmd.Fill(dataSet,"Holds");
return dataSet;
}
}
}
Thanks!
I created a solution for my question. Now I have a SQL Server Report(.rdlc) displaying the data.
Holds.aspx
<form id="form1" runat="server">
<div class="rptParameters">
<table cellpadding="0" cellspacing="0" border="0">
<tr align="left" valign="middle">
<td>
Season:
</td>
<td>
<asp:DropDownList ID="ddlSeason" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSeason_SelectedIndexChanged">
<asp:ListItem Value="" Text=""></asp:ListItem>
<asp:ListItem Value="MC0607" Text="MC0607"></asp:ListItem>
<asp:ListItem Value="MC0708" Text="MC0708"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</div>
<div>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="400px" Width="400px">
</rsweb:ReportViewer>
</div>
</form>
Holds.aspx.cs
using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections;using System.Text;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Microsoft.Reporting.WebForms;public partialclass Test : System.Web.UI.Page{// Handles initial page loadprotected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) { Session["Season"] =null; } }protected void ConfigureReports() { ReportViewer1.LocalReport.ReportPath = Server.MapPath("reports/Holds.rdlc"); DataSet dataSet = DataSetConfiguration.Holds; ReportDataSource ds =new ReportDataSource("HoldsDataSet_Holds", dataSet.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(ds); ReportViewer1.LocalReport.Refresh(); }// Handles season dropdownlist selectedIndexChangedprotected void ddlSeason_SelectedIndexChanged(object sender, EventArgs e) {if (ddlSeason.SelectedIndex == 0) { Session["Season"] =null; }else { Session["Season"] = ddlSeason.SelectedValue; ConfigureReports(); } } } DataSetConfiguration.cs is the same.
FYI I found the information I needed at http://www.codeproject.com/aspnet/ReportViewer.asp
Friday, March 9, 2012
Dynamically create a database field
Does any one know how to create a database field name dynamically or is there a function in crystal similar to the "eval" function in javascript.
I am tyring to loop thru 10 fields ... key0 thru key9 and I want to dynamically create them
Local StringVar str := "";
Local NumberVar i;
For i := 0 To 9 Do
(
str := str + totext({tablename.key[i]})
);
str
Eventually I want to get the value for str.
thanksI think you are trying to concatenate the string values
If so, there is no other way other than specifing the field names|||Yes, that is what I am trying to do... thanks anyway
Dynamically connecting crystal report to different database and server
I am using the following code, but it is not working. I have to use the set location option and change server/database. But I want this to happen dynamically with any server/database names passed from vb front end.
Dim clsCR As New clsCrystalAPI
............
With clsCR
.Database = gstrDatabase
.Password = gstrPassword
.Server = gstrServer
............
End WithWhat is clsCrystalAPI, a custom wrapper for one of the Crystal APIs?
Anyway, one way could be to scroll thru all your tables and use SetLogonInfo on each table. If you also have subreports, you will have to locate them, open, and apply SetLogonInfo to the tables.
Wednesday, March 7, 2012
Dynamically Add Data to Crystal Report from Different Tables
I am sending query to the Crystal report which i have designed.
but at design time i am using table1.
At run time i am sending query which contains table2 .
Table1 and Table2 are same it differs only in data, all fields are same.
Can i send the query to crystal report at run time if my crystal report(at design time) is using group by field at design time.
It's giving error of HResult exception.
Can we provide Multiple Tables Data at dynamically???
I am using crystal report 8.5 n SQL Server 2000
Plz Help me if anybody knows abt it.
Thanks in Advance
Regards
Henry JonesHi,
Yes u can, tell me whats u r Client Application is made of
Claasic VB, VS 2003/2005 Languages ???
Favaz|||See if you find code samples here
http://support.businessobjects.com/
Friday, February 24, 2012
Dynamic table in Crystal report
How can i display dynamic table on the crystal report dependes on the data. I mean how can i add and remove table columne dynamicly dependes on the data comes from the data base.
Thank you for your help...
Best regards,
hohoCan you be more specific on what you have been trying to do?|||Thank you for your reply.
There is a Clients on table in the database and there is another table the clients may has some values in this table and may not. What am trying to do is if the client has any values in this table the report disply the values in the table. this values may be 1 or more so i need to show the table and add the columne as need dependes on the values on the tables. All this need to be daynamicly not a fixed table.
Thank you for your time.
Regards,
hoho|||I dont think that is possible
Anyway check here
http://support.businessobjects.com/