Hola a todos,
alguien puede ayudarme con este codigo, funciona pero el details siempre es
el mismo para todos.
Agraderecia enormemente cualquir ayuda
METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
Local aDataSet := {}
Local cSelect := ""
Local bBlock:={||::SincroMov()}
::oDataset := AppData:oServer:Query(::cSelect )
::SincroMov()
aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
RETURN aDataSet
//---------------------------------------------------------- ---------------------------
METHOD SincroMov( oSender ) CLASS TFrmPersonal
Local cSelect := ""
If !(::oDataset:Eof())
cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
::oDataset1 := AppData:oServer:Query(cSelect)
cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
::oDataset2 := AppData:oServer:Query(cSelect)
cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
::oDataset3 := AppData:oServer:Query(cSelect)
Endif
RETURN Nil
//---------------------------------------------------------- -----------------------------------------
// ES PERTENECE A OTRO FORM
//---------------------------------------------------------- ------------------------------------------
METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
Local oInforme, n
Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a METHOD
AsignaReporte(oSender, nOption)
Default aDataSet To {}
WITH OBJECT oInforme:= FrReportManager():New( Application:cDirectory +
"SystemFrSystH.dll" )
:LoadLangRes( Application:cDirectory + "System" + "Spanish.xml")
:ClearDataSets()
IF LEN( aDataSet[ 1 ] ) > 1
FOR n:= 1 TO LEN( aDataSet )
SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[ n,
2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
NEXT
ENDIF
:SetFileName( ".reportes" +"New_Report.fr3" )
:DesignReport()
:DestroyFr()
END WITH
oInforme:= NIl
Return .T.
Juan Jose Lopez
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4832 (20100203) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Ayuda con Xailer Multiples- Maestror->Detalle en FastReport
-
- Mensajes: 558
- Registrado: Mar Feb 09, 2010 2:26 pm
Ayuda con Xailer Multiples- Maestror->Detalle en FastReport
Saludos:
Siendo un asunto de FasReport, es que Bingen no lo ha visto, si sigues
interesado en conseguirla mandale un correo a su buzón personal, seguro
de que te ayudará en lo que necesites.
bingen@bisoft.es
José Ramón Castro.
El 03/02/2010 21:56, Juan Jose escribió:
> Hola a todos,
> alguien puede ayudarme con este codigo, funciona pero el details siempre es
> el mismo para todos.
> Agraderecia enormemente cualquir ayuda
>
> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>
> Local aDataSet := {}
> Local cSelect := ""
> Local bBlock:={||::SincroMov()}
>
> ::oDataset := AppData:oServer:Query(::cSelect )
>
> ::SincroMov()
>
> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>
> RETURN aDataSet
> //---------------------------------------------------------- ---------------------------
> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>
> Local cSelect := ""
>
> If !(::oDataset:Eof())
>
> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset1 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset2 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset3 := AppData:oServer:Query(cSelect)
>
>
> Endif
>
> RETURN Nil
> //---------------------------------------------------------- -----------------------------------------
> // ES PERTENECE A OTRO FORM
> //---------------------------------------------------------- ------------------------------------------
> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>
> Local oInforme, n
> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a METHOD
> AsignaReporte(oSender, nOption)
>
> Default aDataSet To {}
>
> WITH OBJECT oInforme:= FrReportManager():New( Application:cDirectory +
> "SystemFrSystH.dll" )
>
> :LoadLangRes( Application:cDirectory + "System" + "Spanish.xml")
>
> :ClearDataSets()
>
> IF LEN( aDataSet[ 1 ] )> 1
> FOR n:= 1 TO LEN( aDataSet )
> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[ n,
> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
> NEXT
> ENDIF
>
> :SetFileName( ".reportes" +"New_Report.fr3" )
>
> :DesignReport()
>
> :DestroyFr()
>
> END WITH
> oInforme:= NIl
>
> Return .T.
>
> Juan Jose Lopez
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4832 (20100203) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
Siendo un asunto de FasReport, es que Bingen no lo ha visto, si sigues
interesado en conseguirla mandale un correo a su buzón personal, seguro
de que te ayudará en lo que necesites.
bingen@bisoft.es
José Ramón Castro.
El 03/02/2010 21:56, Juan Jose escribió:
> Hola a todos,
> alguien puede ayudarme con este codigo, funciona pero el details siempre es
> el mismo para todos.
> Agraderecia enormemente cualquir ayuda
>
> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>
> Local aDataSet := {}
> Local cSelect := ""
> Local bBlock:={||::SincroMov()}
>
> ::oDataset := AppData:oServer:Query(::cSelect )
>
> ::SincroMov()
>
> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>
> RETURN aDataSet
> //---------------------------------------------------------- ---------------------------
> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>
> Local cSelect := ""
>
> If !(::oDataset:Eof())
>
> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset1 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset2 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset3 := AppData:oServer:Query(cSelect)
>
>
> Endif
>
> RETURN Nil
> //---------------------------------------------------------- -----------------------------------------
> // ES PERTENECE A OTRO FORM
> //---------------------------------------------------------- ------------------------------------------
> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>
> Local oInforme, n
> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a METHOD
> AsignaReporte(oSender, nOption)
>
> Default aDataSet To {}
>
> WITH OBJECT oInforme:= FrReportManager():New( Application:cDirectory +
> "SystemFrSystH.dll" )
>
> :LoadLangRes( Application:cDirectory + "System" + "Spanish.xml")
>
> :ClearDataSets()
>
> IF LEN( aDataSet[ 1 ] )> 1
> FOR n:= 1 TO LEN( aDataSet )
> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[ n,
> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
> NEXT
> ENDIF
>
> :SetFileName( ".reportes" +"New_Report.fr3" )
>
> :DesignReport()
>
> :DestroyFr()
>
> END WITH
> oInforme:= NIl
>
> Return .T.
>
> Juan Jose Lopez
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4832 (20100203) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
Ayuda con Xailer Multiples- Maestror->Detalle en FastReport
Gracais José Ramón
"José Ramón Castro Polinio" <jrcpoli-quitarpara_envio]"@terra.es> escribió
en el mensaje news:[email=4b6dabbc@svctag-j7w3v3j....]4b6dabbc@svctag-j7w3v3j....[/email]
> Saludos:
>
> Siendo un asunto de FasReport, es que Bingen no lo ha visto, si sigues
> interesado en conseguirla mandale un correo a su buzón personal, seguro de
> que te ayudará en lo que necesites.
>
> bingen@bisoft.es
>
> José Ramón Castro.
>
> El 03/02/2010 21:56, Juan Jose escribió:
>> Hola a todos,
>> alguien puede ayudarme con este codigo, funciona pero el details siempre
>> es
>> el mismo para todos.
>> Agraderecia enormemente cualquir ayuda
>>
>> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>>
>> Local aDataSet := {}
>> Local cSelect := ""
>> Local bBlock:={||::SincroMov()}
>>
>> ::oDataset := AppData:oServer:Query(::cSelect )
>>
>> ::SincroMov()
>>
>> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
>> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
>> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
>> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>>
>> RETURN aDataSet
>> //---------------------------------------------------------- ---------------------------
>> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>>
>> Local cSelect := ""
>>
>> If !(::oDataset:Eof())
>>
>> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset1 := AppData:oServer:Query(cSelect)
>>
>> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset2 := AppData:oServer:Query(cSelect)
>>
>> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset3 := AppData:oServer:Query(cSelect)
>>
>>
>> Endif
>>
>> RETURN Nil
>> //---------------------------------------------------------- -----------------------------------------
>> // ES PERTENECE A OTRO FORM
>> //---------------------------------------------------------- ------------------------------------------
>> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>>
>> Local oInforme, n
>> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a
>> METHOD
>> AsignaReporte(oSender, nOption)
>>
>> Default aDataSet To {}
>>
>> WITH OBJECT oInforme:= FrReportManager():New(
>> Application:cDirectory +
>> "SystemFrSystH.dll" )
>>
>> :LoadLangRes( Application:cDirectory + "System" +
>> "Spanish.xml")
>>
>> :ClearDataSets()
>>
>> IF LEN( aDataSet[ 1 ] )> 1
>> FOR n:= 1 TO LEN( aDataSet )
>> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[
>> n,
>> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
>> NEXT
>> ENDIF
>>
>> :SetFileName( ".reportes" +"New_Report.fr3" )
>>
>> :DesignReport()
>>
>> :DestroyFr()
>>
>> END WITH
>> oInforme:= NIl
>>
>> Return .T.
>>
>> Juan Jose Lopez
>>
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 4832 (20100203) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 4842 (20100206) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4842 (20100206) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
"José Ramón Castro Polinio" <jrcpoli-quitarpara_envio]"@terra.es> escribió
en el mensaje news:[email=4b6dabbc@svctag-j7w3v3j....]4b6dabbc@svctag-j7w3v3j....[/email]
> Saludos:
>
> Siendo un asunto de FasReport, es que Bingen no lo ha visto, si sigues
> interesado en conseguirla mandale un correo a su buzón personal, seguro de
> que te ayudará en lo que necesites.
>
> bingen@bisoft.es
>
> José Ramón Castro.
>
> El 03/02/2010 21:56, Juan Jose escribió:
>> Hola a todos,
>> alguien puede ayudarme con este codigo, funciona pero el details siempre
>> es
>> el mismo para todos.
>> Agraderecia enormemente cualquir ayuda
>>
>> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>>
>> Local aDataSet := {}
>> Local cSelect := ""
>> Local bBlock:={||::SincroMov()}
>>
>> ::oDataset := AppData:oServer:Query(::cSelect )
>>
>> ::SincroMov()
>>
>> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
>> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
>> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
>> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>>
>> RETURN aDataSet
>> //---------------------------------------------------------- ---------------------------
>> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>>
>> Local cSelect := ""
>>
>> If !(::oDataset:Eof())
>>
>> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset1 := AppData:oServer:Query(cSelect)
>>
>> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset2 := AppData:oServer:Query(cSelect)
>>
>> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
>> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
>> ::oDataset3 := AppData:oServer:Query(cSelect)
>>
>>
>> Endif
>>
>> RETURN Nil
>> //---------------------------------------------------------- -----------------------------------------
>> // ES PERTENECE A OTRO FORM
>> //---------------------------------------------------------- ------------------------------------------
>> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>>
>> Local oInforme, n
>> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a
>> METHOD
>> AsignaReporte(oSender, nOption)
>>
>> Default aDataSet To {}
>>
>> WITH OBJECT oInforme:= FrReportManager():New(
>> Application:cDirectory +
>> "SystemFrSystH.dll" )
>>
>> :LoadLangRes( Application:cDirectory + "System" +
>> "Spanish.xml")
>>
>> :ClearDataSets()
>>
>> IF LEN( aDataSet[ 1 ] )> 1
>> FOR n:= 1 TO LEN( aDataSet )
>> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[
>> n,
>> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
>> NEXT
>> ENDIF
>>
>> :SetFileName( ".reportes" +"New_Report.fr3" )
>>
>> :DesignReport()
>>
>> :DestroyFr()
>>
>> END WITH
>> oInforme:= NIl
>>
>> Return .T.
>>
>> Juan Jose Lopez
>>
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 4832 (20100203) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 4842 (20100206) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4842 (20100206) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
-
- Mensajes: 1310
- Registrado: Mié Sep 26, 2007 7:12 pm
Ayuda con Xailer Multiples- Maestror->Detalle en FastReport
Perdón que no lo he visto hasta hoy....
Vamos a ver como se hace el maestro-detalle en FR.
En principio yo de verdad solo lo he hecho con DBFs pero te explico como
y luego te explico como lo he hecho en falso con Sql.
1.- Con Dbfs es facil hacer un DbSetRelation de toda la vida para
relaccionar 2 tablas DBF en base a un campo
USE Facturas NEW
USE FacLineas NEW
SET INDEX TO NumFac
SELECT Facturas
DbSetRelation("FacLineas", {||NumFac})
Con esto ambas tablas estarían sincronizadas para xHb pero FR a pesar de
que le envies las tablas
oFr:SetWorkArea("Facturas", Select("Facturas"))
oFr:SetWorkArea("FacLineas", Select("Faclineas"))
No tendrá en cuenta la relación entre ellas a no ser que se la indiques
también
oFr:SetResyncPair("Facturas", "FacLineas")
oFr:DesignReport()
oFr:ClearResyncPair("Facturas", "FacLineas")
oFr:ClearDataSets()
Otra manera de hacerlo que indica el manual aunque no la he usado es:
oFr:SetMasterDetail("Facturas","FacLineas",{|| Facturas->Lineas})
oFr:DesignReport()
oFr:ClearMasterDetail( "FacLineas" )
Por último y como en SQL no conozco la posibilidad de un DbSetRelation
lo que he hecho es prepararme un MemDataset que incluya en cada registro
los datos del maestro (repetidos en n líneas) y los datos del detalle (1
por línea) y a continuación he hecho el reporte con este memdataset,
agrupando por datos del maestro y mostrando en las líneas de datos solo
las del detalle.
O sea un Maestro-Detalle falso, pre-montado a mano con anterioridad.
Espero que te valgan las ideas.
Salu2.
>
> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>
> Local aDataSet := {}
> Local cSelect := ""
> Local bBlock:={||::SincroMov()}
>
> ::oDataset := AppData:oServer:Query(::cSelect )
>
> ::SincroMov()
>
> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
90> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>
> RETURN aDataSet
> //---------------------------------------------------------- ---------------------------
> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>
> Local cSelect := ""
>
> If !(::oDataset:Eof())
>
> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset1 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset2 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset3 := AppData:oServer:Query(cSelect)
>
>
> Endif
>
> RETURN Nil
> //---------------------------------------------------------- -----------------------------------------
> // ES PERTENECE A OTRO FORM
> //---------------------------------------------------------- ------------------------------------------
> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>
> Local oInforme, n
> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a METHOD
> AsignaReporte(oSender, nOption)
>
> Default aDataSet To {}
>
> WITH OBJECT oInforme:= FrReportManager():New( Application:cDirectory +
> "SystemFrSystH.dll" )
>
> :LoadLangRes( Application:cDirectory + "System" + "Spanish.xml")
>
> :ClearDataSets()
>
> IF LEN( aDataSet[ 1 ] )> 1
> FOR n:= 1 TO LEN( aDataSet )
> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[ n,
> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
> NEXT
> ENDIF
>
> :SetFileName( ".reportes" +"New_Report.fr3" )
>
> :DesignReport()
>
> :DestroyFr()
>
> END WITH
> oInforme:= NIl
>
> Return .T.
>
> Juan Jose Lopez
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4832 (20100203) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
Vamos a ver como se hace el maestro-detalle en FR.
En principio yo de verdad solo lo he hecho con DBFs pero te explico como
y luego te explico como lo he hecho en falso con Sql.
1.- Con Dbfs es facil hacer un DbSetRelation de toda la vida para
relaccionar 2 tablas DBF en base a un campo
USE Facturas NEW
USE FacLineas NEW
SET INDEX TO NumFac
SELECT Facturas
DbSetRelation("FacLineas", {||NumFac})
Con esto ambas tablas estarían sincronizadas para xHb pero FR a pesar de
que le envies las tablas
oFr:SetWorkArea("Facturas", Select("Facturas"))
oFr:SetWorkArea("FacLineas", Select("Faclineas"))
No tendrá en cuenta la relación entre ellas a no ser que se la indiques
también
oFr:SetResyncPair("Facturas", "FacLineas")
oFr:DesignReport()
oFr:ClearResyncPair("Facturas", "FacLineas")
oFr:ClearDataSets()
Otra manera de hacerlo que indica el manual aunque no la he usado es:
oFr:SetMasterDetail("Facturas","FacLineas",{|| Facturas->Lineas})
oFr:DesignReport()
oFr:ClearMasterDetail( "FacLineas" )
Por último y como en SQL no conozco la posibilidad de un DbSetRelation
lo que he hecho es prepararme un MemDataset que incluya en cada registro
los datos del maestro (repetidos en n líneas) y los datos del detalle (1
por línea) y a continuación he hecho el reporte con este memdataset,
agrupando por datos del maestro y mostrando en las líneas de datos solo
las del detalle.
O sea un Maestro-Detalle falso, pre-montado a mano con anterioridad.
Espero que te valgan las ideas.
Salu2.
>
> METHOD AsignaReporte(oSender, nOption) CLASS TFrmPersonal
>
> Local aDataSet := {}
> Local cSelect := ""
> Local bBlock:={||::SincroMov()}
>
> ::oDataset := AppData:oServer:Query(::cSelect )
>
> ::SincroMov()
>
> aadd(aDataSet, {"TABLA", ::oDataSet,.T., bBlock})
90> aadd(aDataSet, {"TABLA1 ::oDataSet1, Nil, Nil})
> aadd(aDataSet, {"TABLA2 ::oDataSet2, Nil, Nil})
> aadd(aDataSet, {"TABLA3 ::oDataSet3, Nil, Nil})
>
> RETURN aDataSet
> //---------------------------------------------------------- ---------------------------
> METHOD SincroMov( oSender ) CLASS TFrmPersonal
>
> Local cSelect := ""
>
> If !(::oDataset:Eof())
>
> cSelect="SELECT campo1, campo2 FROM table1 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset1 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table2 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset2 := AppData:oServer:Query(cSelect)
>
> cSelect="SELECT campo1, campo2 FROM table3 WHERE nif = ? "
> cSelect := AppData:oServer:BuildSQLSt(cSelect,::oDataset:nif)
> ::oDataset3 := AppData:oServer:Query(cSelect)
>
>
> Endif
>
> RETURN Nil
> //---------------------------------------------------------- -----------------------------------------
> // ES PERTENECE A OTRO FORM
> //---------------------------------------------------------- ------------------------------------------
> METHOD PrintReport(nOption, lPreview) CLASS TFrmSelReport
>
> Local oInforme, n
> Local aDataSet := ::OnPrint(nOption) //=> Evento que llama a METHOD
> AsignaReporte(oSender, nOption)
>
> Default aDataSet To {}
>
> WITH OBJECT oInforme:= FrReportManager():New( Application:cDirectory +
> "SystemFrSystH.dll" )
>
> :LoadLangRes( Application:cDirectory + "System" + "Spanish.xml")
>
> :ClearDataSets()
>
> IF LEN( aDataSet[ 1 ] )> 1
> FOR n:= 1 TO LEN( aDataSet )
> SetXailerDataSet( oInforme, aDataSet[ n, 1 ], aDataSet[ n,
> 2 ], aDataSet[ n, 3 ], aDataSet[ n, 4 ] )
> NEXT
> ENDIF
>
> :SetFileName( ".reportes" +"New_Report.fr3" )
>
> :DesignReport()
>
> :DestroyFr()
>
> END WITH
> oInforme:= NIl
>
> Return .T.
>
> Juan Jose Lopez
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4832 (20100203) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>