PDA

Click to See Complete Forum and Search --> : Parameters


Luis Moises Rojas
Jun 30th, 2008, 01:50 PM
I am using vs2005 (c#), and i am calling a report in crystal.
I have a parameter fields (@secuencia) and i want to print only those records with that criteria. So i have to create (i think) the following:
Report --->Selection Formula --> Record and :{v_reportes.secuencia}=@secuencia, where @secuencia is the parameters.

To me this is ok, but crystal says: missing ")".
If i use:{v_reportes.secuencia}=7 Where 7 is a secuencia, works!


what i'm doing wrong?

Besoup
Jun 30th, 2008, 08:23 PM
plz post the code where you're passing the parameter.

Luis Moises Rojas
Jul 1st, 2008, 08:19 AM
private void Procesarreporte()
{
CrystalDecisions.Shared.ParameterValues pvCollection = new CrystalDecisions.Shared.ParameterValues();
CrystalDecisions.Shared.ParameterDiscreteValue pdvCustomerName = new CrystalDecisions.Shared.ParameterDiscreteValue();

ReportDocument rptticket = new ReportDocument();

try
{
rptticket.Load(@"..\..\rptticket.rpt");
pdvCustomerName.Value = gTicket;
pvCollection.Add(pdvCustomerName);

rptticket.SetParameterValue("@secuencia", gTicket);
rptticket.DataDefinition.ParameterFields["@Secuencia"].ApplyCurrentValues(pvCollection);

/* foreach(CrystalDecisions.CrystalReports.Engine.Table tbCurrent in rptcuentaespecifica.Database.Tables)
{
tliCurrent = tbCurrent.LogOnInfo;
//tliCurrent.ConnectionInfo.ServerName = "sqlserv01";
//tliCurrent.ConnectionInfo.UserID = string.Empty;
//tliCurrent.ConnectionInfo.Password = string.Empty;
tliCurrent.ConnectionInfo.DatabaseName = "Caja";
//tbCurrent.ApplyLogOnInfo(tliCurrent);
} */
crvBasic.ReportSource = rptticket;
crvBasic.Zoom(2);
crvBasic.Visible = true;
}
catch (LoadSaveReportException Exp)
{
MessageBox.Show(Exp.Message, this.Text);

MessageBox.Show("No se encuentra la ruta y/o el reporte para ser ejecutado.", "Error");

}
catch (Exception Exp)
{
MessageBox.Show(Exp.Message, "General Error");
}

}

and in crystal report i have created a formula in order to recieved the parameter, but crystal says it is wrong. This is the formula: :{v_reportes.secuencia}=@secuencia, where @secuencia is a parameter

Besoup
Jul 1st, 2008, 08:23 AM
Try replacing your parameter code with something like this:

rptticket.SetParameterValue("@secuencia", gTicket)

that is all you really need to pass a parameter over to your CR.