Show master row if no detail rows

I have a master-detail report and I am putting the master and detail data in the same rows and hiding the master row. This is because my report has only a single (relevant) detail record per master record.

master.field1 master.field2 detail.field1 detail.field2

The problem is that the row does not shoe if there is no detail record for that master record.

I am trying the following:
1. Make a master row that looks like
master.field1 master.field2
2. Only show the master row if there are no detail rows for that master row.

How can I get the number of detail rows for a given master row so I can set the master row visibility in code?

Comments

  • edited May 2018
    set report to 'Double Pass' and use script :
    namespace FastReport
    {
      public class ReportScript
      {
        private List<int> list = new List<int>();
        private bool flag;
        
            // MASTER BAND
        private void Data2_BeforePrint(object sender, EventArgs e)
        {
          flag = true;      
          if (Engine.FinalPass)
          {
            int id = (int)Report.GetColumnValue("Orders.OrderID");
            if (list.Contains(id))
              Data2.Visible = false;
            else
              Data2.Visible = true;         
          }             
        }
    
            // DETAIL BAND
        private void Data1_BeforePrint(object sender, EventArgs e)
        {
          if (Engine.FirstPass && flag)
          {
               int id = (int)Report.GetColumnValue("Order Details.OrderID");
               list.Add(id);
               flag = false;
          }
        }
      }
    }
    
  • edited 9:53PM
    That worked perfectly. Thank-you.
    May it go well for you.

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.