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)
hemantpandya
Posts: 11
Joined: Wed Apr 20, 2016 7:30 am

How to set Master - Detail Relation in Report Designer

Postby hemantpandya » Sun Apr 24, 2016 7:39 am

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
User avatar
ignacio
Site Admin
Posts: 8690
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

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

Postby ignacio » Mon Apr 25, 2016 9:57 am

Hello,

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

1) Via SET RELATION (Harbour side):

Code: Select all

   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:

Code: Select all

   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]
http://www.xailer.com
hemantpandya
Posts: 11
Joined: Wed Apr 20, 2016 7:30 am

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

Postby hemantpandya » Mon Apr 25, 2016 12:07 pm

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

Return to “FastReport”