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.

How to set Master - Detail Relation in Report Designer

FastReport for Xailer & [x]Harbour (English/Spanish)
Responder
hemantpandya
Mensajes: 11
Registrado: Mié Abr 20, 2016 7:30 am

How to set Master - Detail Relation in Report Designer

Mensaje por hemantpandya »

Hi All

I am a Newbee. Just started using FRH. I want to create/design Master Detail report in Report Designer. Not sure how to relate/link field of Master & Detail. Using following code to invoke report Designer.

use depo new // <- Detail
set orde to 2
use gr new // <- Master
set orde to 1

// need to link with gr->gcode = depo->gcod

WITH OBJECT oReport := TFastReport():New()
:AddDbf( "GR", { "GR->*" } )
:AddDbf( "depo", { "depo->*" } )
:Create()
:DesignReport()
:End()
END WITH

In designer created Master & Detail Band but not sure how to link field ( gr->gcode = depo->gcod) haven't seen any Field Link Designer where I can link the field from 2 DBF.
Please Guide me.

Thanks in advance.
Hemant
Sydney-Australia
Avatar de Usuario
ignacio
Site Admin
Mensajes: 8840
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: How to set Master - Detail Relation in Report Designer

Mensaje por ignacio »

Hello,

Take a look FR sample. There are two ways to establish the master-child relation :

1) Via SET RELATION (Harbour side):

Código: Seleccionar todo

   USE .\DATA\CUSTOMER SHARED VIA "DBFCDX" NEW
   SET ORDER TO TAG "CUSTNO"
   USE .\DATA\ORDERS SHARED VIA "DBFCDX" NEW
   SET RELATION TO CustNo INTO CUSTOMER

   WITH OBJECT oReport := TFastReport():New()
      :AddDbf( "ORDERS", { "Orders->*", "Customer->*" } )
      :Create()
      :cFilename := ".\Reports\Relations2.fr3"
      IF !lDesign
         :ShowReport()
      ELSE
         :DesignReport()
      ENDIF
      :End()
   END WITH
2) Via FR:

Código: Seleccionar todo

   USE .\DATA\CUSTOMER SHARED VIA "DBFCDX" NEW
   USE .\DATA\ORDERS SHARED VIA "DBFCDX" NEW

   WITH OBJECT oReport := TFastReport():New()
      oCustomer := :AddDbf( "CUSTOMER", { "Customer->*" } )
      oOrders   := :AddDbf( "ORDERS", { "Orders->*" } )
      oOrders:SetMaster( oCustomer, {"CUSTNO=CUSTNO"} )
      :Create()
      :cFilename := ".\Reports\Relations.fr3"
      IF !lDesign
         :ShowReport()
      ELSE
         :DesignReport()
      ENDIF
      :End()
   END WITH
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
hemantpandya
Mensajes: 11
Registrado: Mié Abr 20, 2016 7:30 am

Re: How to set Master - Detail Relation in Report Designer

Mensaje por hemantpandya »

Hi ignacio,

Thank you very much for your guidance, much appreciated. Will try accordingly and if any issue will get back to forum.

Regards
Hemant
Responder