/// <inheritdoc/> public override void LoadData(ArrayList rows) { rows.Clear(); // custom load data via Load event OnLoad(); DataSourceBase parent = ParentDataSource; bool isMasterDetail = parent != null && parent.RowCount > 0; if (isMasterDetail) { LoadData(this.Value as IEnumerable, rows); } else { // ensure that parent is loaded if (parent != null && parent.InternalRows.Count == 0) { parent.Init(); } if (parent == null) { // this is a root business object, its Reference property contains IEnumerable. LoadData(Reference as IEnumerable, rows); } else { // enumerate parent rows to fill this data source completely parent.First(); while (parent.HasMoreRows) { LoadData(this.Value as IEnumerable, rows); parent.Next(); } // bug fix - two-pass report shows empty data parent.ClearData(); } } }
internal void Init(Relation relation, string filter, SortCollection sort, bool useAllParentRows) { if (FShowAccessDataMessage) { Config.ReportSettings.OnProgress(Report, Res.Get("Messages,AccessingData")); } // InitSchema may fail sometimes (for example, when using OracleConnection with nested select). try { InitSchema(); } catch { } LoadData(); // fill rows, emulate relation rows.Clear(); if (relation != null && relation.Enabled) { if (useAllParentRows) { DataSourceBase parentData = relation.ParentDataSource; // parentData must be initialized prior to calling this method! parentData.First(); while (parentData.HasMoreRows) { GetChildRows(relation); parentData.Next(); } } else { GetChildRows(relation); } } else { foreach (object row in InternalRows) { rows.Add(row); } } // filter data rows if (FShowAccessDataMessage && rows.Count > 10000) { Config.ReportSettings.OnProgress(Report, Res.Get("Messages,PreparingData")); } if (filter != null && filter.Trim() != "") { for (int i = 0; i < rows.Count; i++) { CurrentRowNo = i; object match = Report.Calc(filter); if (match is bool && !(bool)match) { rows.RemoveAt(i); i--; } } } // additional filter if (AdditionalFilter.Count > 0) { ApplyAdditionalFilter(); } // sort data rows if (sort != null && sort.Count > 0) { string[] expressions = new string[sort.Count]; bool[] descending = new bool[sort.Count]; for (int i = 0; i < sort.Count; i++) { expressions[i] = sort[i].Expression; descending[i] = sort[i].Descending; } rows.Sort(new RowComparer(Report, this, expressions, descending)); } FShowAccessDataMessage = false; First(); }