Crystal Report - Enviar un parámetro a un reporte

 
Vista:

Enviar un parámetro a un reporte

Publicado por Julian Mora (13 intervenciones) el 29/06/2007 17:40:57
Lo que necesito no es enviar un parámetro para generar el reporte sino uno para podérselo asignar a un label en el reporte por ejemplo:

Mi reporte puede ser sobre el total de horas trabajadas de cierto empleado:

HORAS TRABAJADAS DEL EMPLEADO: <NOMBRE DEL EMPLEADO>
_____________________
|__HORAS___|__FECHA__|
| ____8_____|_28/6/2007_|

...etc

Lo que me interesa es poder enviarle por parámetro al reporte el nombre del empleado
para poder incluirlo en el encabezado del reporte.

**Estoy utilizando visual basic .net 2002 y un reportviewer**
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:Enviar un parámetro a un reporte

Publicado por P. J. (1 intervención) el 03/07/2007 23:24:49
Saludos Julian,

Mira yo tengo un requerimiento similar al tuyo pero en mi caso debo mostrar la RAZON SOCIAL DE LA EMPRESA ( pos el sist. que toy haciendo unifica 5 empresas :D ), y bueno encontre esta solucion (uso .Net 2005) espero te sea util:

Dim oReporteGeneral As New frmReporteGeneral 'Formulario con el Viewer
Dim oReporte As New rptMantTipoVenta ' Archivo .RPT

If dgvTipoVenta.RowCount > 0 Then ' Si hay datos en el grid
oReporte.SetDataSource(dt) ' Asigno el datatable con la data actual

Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues

crParameterFieldDefinitions = oReporte.DataDefinition.ParameterFields
crParameterFieldLocation = crParameterFieldDefinitions.Item ("@EMPRESA")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
Select Case FuncionesGlobales.empresa
Case "GS"
crParameterDiscreteValue.Value = "GEO SYSTEMS S.A.C."
Case "GV"
crParameterDiscreteValue.Value = "GEO SERVICE RENT S.A.C."
End Select
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)

oReporteGeneral.oReporte = oReporte
oReporteGeneral.MdiParent = Me.MdiParent
oReporteGeneral.Show()
Else
MsgBox("El reporte no tiene Items que mostrar.", MsgBoxStyle.Information, "SIGNet")
End If

Alli esta solo cambia tu VALOR que desees mostrar en mi caso pongo GEO...
debes importar lo sgte:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Y debes agregar el parametro @EMPRESA en tu REPORTE me imagino ya tienes eso ¿ no?, Cualkier duda o consulta me escribes a mi correo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Enviar un parámetro a un reporte

Publicado por mighel aliaga (1 intervención) el 06/07/2007 23:29:49
oe haganle caso ps al pobre quimera alias Pablinchi jejejeje
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Enviar un parámetro a un reporte

Publicado por marvin (85 intervenciones) el 11/07/2007 20:41:30
porque no probas esto?
le pones un parámetro a tu reporte (del tipo parameter field) y le pones el nombre como quieras por ejemplo Parametro.

Ahora entiendo que necesitas pasarselo desde visual basic, entonces haces esto:

Reporte.ParameterFields(1).AddCurrentValue "" & ParamFechaIni & ""

donde:
Dim Reporte As CRAXDRT.Report
Dim ParamFechaIni as String

espero q te sirva esto....

salu2

marvin
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar