public void FillSummaryCollection(EbReport report, EbDataField field, EbReportSectionType section_typ)
 {
     if (section_typ == EbReportSectionType.ReportGroups)
     {
         if (!report.GroupSummaryFields.ContainsKey(field.SummaryOf))
         {
             report.GroupSummaryFields.Add(field.SummaryOf, new List <EbDataField> {
                 field
             });
         }
         else
         {
             report.GroupSummaryFields[field.SummaryOf].Add(field);
         }
     }
     if (section_typ == EbReportSectionType.PageFooter)
     {
         if (!report.PageSummaryFields.ContainsKey(field.SummaryOf))
         {
             report.PageSummaryFields.Add(field.SummaryOf, new List <EbDataField> {
                 field
             });
         }
         else
         {
             report.PageSummaryFields[field.SummaryOf].Add(field);
         }
     }
     if (section_typ == EbReportSectionType.ReportFooter)
     {
         if (!report.ReportSummaryFields.ContainsKey(field.SummaryOf))
         {
             report.ReportSummaryFields.Add(field.SummaryOf, new List <EbDataField> {
                 field
             });
         }
         else
         {
             report.ReportSummaryFields[field.SummaryOf].Add(field);
         }
     }
 }
        private void Fill(EbReport Report, List <EbReportField> fields, EbReportSectionType section_typ)
        {
            foreach (EbReportField field in fields)
            {
                if (!String.IsNullOrEmpty(field.HideExpression?.GetCode()))
                {
                    Report.ExecuteHideExpression(field);
                }
                if (!field.IsHidden && !String.IsNullOrEmpty(field.LayoutExpression?.GetCode()))
                {
                    Report.ExecuteLayoutExpression(field);
                }
                if (field is EbDataField)
                {
                    EbDataField field_org = field as EbDataField;

                    if (section_typ == EbReportSectionType.Detail)
                    {
                        FindLargerDataTable(Report, field_org);
                    }

                    if (field is IEbDataFieldSummary)
                    {
                        FillSummaryCollection(Report, field_org, section_typ);
                    }

                    if (field is EbCalcField && !Report.ValueScriptCollection.ContainsKey(field.Name) && !string.IsNullOrEmpty((field_org as EbCalcField).ValExpression?.Code))
                    {
                        string processedCode = Report.GetProcessedCodeForScriptCollection((field as EbCalcField).ValExpression.GetCode());
                        Report.ValueScriptCollection.Add(field.Name, processedCode);
                    }

                    if (!field.IsHidden && !Report.AppearanceScriptCollection.ContainsKey(field.Name) && !string.IsNullOrEmpty(field_org.AppearExpression?.Code))
                    {
                        string processedCode = Report.GetProcessedCodeForScriptCollection(field_org.AppearExpression.GetCode());
                        Report.AppearanceScriptCollection.Add(field.Name, processedCode);
                    }
                }
            }
        }
 public void FindLargerDataTable(EbReport Report, EbDataField field)
 {
     if (!Report.HasRows || field.TableIndex != Report.DetailTableIndex)
     {
         if (Report.DataSet?.Tables.Count > 0)
         {
             if (Report.DataSet.Tables[field.TableIndex].Rows != null)
             {
                 Report.HasRows = true;
                 int r_count = Report.DataSet.Tables[field.TableIndex].Rows.Count;
                 Report.DetailTableIndex = (r_count > Report.MaxRowCount) ? field.TableIndex : Report.DetailTableIndex;
                 Report.MaxRowCount      = (r_count > Report.MaxRowCount) ? r_count : Report.MaxRowCount;
             }
             else
             {
                 Console.WriteLine("Report.DataSet.Tables[field.TableIndex].Rows is null");
             }
         }
         else
         {
             Console.WriteLine("Report.DataSet.Tables.Count is 0");
         }
     }
 }