Master - detail problem

I'm having problems setting up a master-detail report. What I have is:

IBXQuery1: the masterdata
IBXQuery2: the detaildata, containing the parameter :IDParam

Both of the queries have a ID-field, containing matching information.

IBXQuery2.Master=IBXQuery1
In the IBXQuery2.params I've set up Name=IDParam, DataType=Integer, Value=<IBXQuery1."ID">

On my report page I have 2 bands:
- a TfrxMasterData band where dataset=IBXQuery1
- a TfrxDetailData band where dataset=IBXQuery2

When running the report I can't get the detaildata to follow the materdata in the output. The detail is returning only data from the first master.
What am I missing here?

Petter

Comments

  • gpigpi
    edited 2:09PM
    You should reopen detail dataset in MasterData OnBeforePrint event or use correct detail SQL like

    select * from detail_table where id = :id
  • edited 2:09PM
    gpi wrote: »
    You should reopen detail dataset in MasterData OnBeforePrint event or use correct detail SQL like

    select * from detail_table where id = :id

    Thanks.

    My detail SQL looks basicly just like this...

    So I tried the OBP-event of Masterdata band (IBXQuery1):

    IBXQuery2.Close;
    IBXQuery2.Open;
    (also tried to add IBXQuery2.First)

    What then happens is that the report ends when it was supposed to print the second master's details. And the rest of the masterdata is not printed...
  • gpigpi
    edited 2:09PM
    Try
    IBXQuery2.Close;
    //set query parameter here
    IBXQuery2.Open;
    
    Create and attach demo report template based on employee.gdb database
  • edited 2:09PM
    gpi wrote: »
    Try
    IBXQuery2.Close;
    //set query parameter here
    IBXQuery2.Open;
    
    Create and attach demo report template based on employee.gdb database

    Thanks again.

    Now it's working. The OBP-event open/close code actually solved my problem, without the need of resetting parameters there.

    The reason why the report ended after the second masterdata-print, was that this masterdata record had no details. So I checked the Masterdata.PrintIfDetailEmpty, and now it works like expected.

    Maybe is it a bug that causes the report to end instead of forwarding to next record in masterdata when Masterdata.PrintIfDetailEmpty=false?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.