Hi,
The problem we are having I believe is very similar to this:
http://es.infragistics.com/community/forums/t/58897.aspx
But, we have tried what is suggested there (static function) and we have not been able to fix our problem.
We are simply trying to create an Object Data Source. But when we try to select the class that will return the data, we cannot find ANY properties or methods to select.
We are using v14.1 of Infragistics tools.
Here is a code snippet showing some of the ReportDataViewModel class we are trying to use to create the data source:
public class ReportDataViewModel : DataViewModel { Frequency _frequency; int? _index; Report _report; public Report Report { get { return _report; } } public Forecast Forecast { get { return _report.Forecast; } } public ForecastViewModel ForecastVM { get { return ViewModelFactory.GetForecastViewModel(_report); } } public override string Label { get { if (_frequency == Forecast.CycleFrequency || _index == null) return "All"; else return Forecast.CyclePeriods[(int)_index].Label; } } DataView _dataView; public override DataView DataView { get { var ind = _index; if (Report is VarianceReport) ind = MainWindowViewModel.MainWindowVM.SelectedActualIndex; if (_dataView == null) using (new WaitCursor()) _dataView = _report[_frequency, ind, true]; return _dataView; } } public static IEnumerable<ReportDataRow> ReportDataSource(DataView theView) { foreach (DataRowView rowView in theView) { DataRow row = rowView.Row; yield return new ReportDataRow { ParentRowNum = row["ParentRowNum"] is System.DBNull ? 0 : (int)row["ParentRowNum"], RowNum = row["RowNum"] is System.DBNull ? 0 : (long)row["RowNum"], Name = row["Name"].ToString(), Id = row["Id"] is System.DBNull ? 0 : (int)row["Id"], NodeType = row["NodeType"] is System.DBNull ? 30000 : (int)row["NodeType"], NodePath = (string)row["NodePath"], RecordNodeId = row["RecordNodeId"] is System.DBNull ? 0 : (int)row["RecordNodeId"], BudgetDataType = row["BudgetDataType"] is System.DBNull ? 0 : (int)row["BudgetDataType"], BudgetDataNodeId = row["BudgetDataNodeId"] is System.DBNull ? 0 : (int)row["BudgetDataNodeId"], ResultNodeId = row["ResultNodeId"] is System.DBNull ? 0 : (int)row["ResultNodeId"], Opening = row[10] is System.DBNull ? 0 : (decimal)row[10], Period0 = row[11] is System.DBNull ? 0 : (decimal)row[11], Period1 = row[12] is System.DBNull ? 0 : (decimal)row[12], Period2 = row[13] is System.DBNull ? 0 : (decimal)row[13], Period3 = row[14] is System.DBNull ? 0 : (decimal)row[14], Period4 = row[15] is System.DBNull ? 0 : (decimal)row[15], Period5 = row[16] is System.DBNull ? 0 : (decimal)row[16], Period6 = row[17] is System.DBNull ? 0 : (decimal)row[17], Period7 = row[18] is System.DBNull ? 0 : (decimal)row[18], Period8 = row[19] is System.DBNull ? 0 : (decimal)row[19], Period9 = row[20] is System.DBNull ? 0 : (decimal)row[20], Period10 = row[21] is System.DBNull ? 0 : (decimal)row[21], Period11 = row[22] is System.DBNull ? 0 : (decimal)row[22], }; } } public string Format { get { return Forecast.Format + ";-"; } }
Hi Forecast Five,
The Data Source Configuration Wizard can only handle methods that take in generic arguments like int, string, decimal, etc. It doesn't handle complex types. When you try to create a data source from a method that takes arguments, the wizard will ask you for what arguments you want to pass to the method. The wizard does not have the capability to create a complex type to pass to this argument so we only support generics.
I think you'll need to go about this differently. Rather than trying to pass a DataView directly to the method, your method should take in an ID or something that the method can then use to identify which DataView to use and this DataView should be stored somewhere the method can access it from.
Thanks for the prompt reply Rob, but we think something else is going on.
We took what you said on board, and we create a simple datasource.
We created a new static class like this:
namespace Forecast5.ViewModel { public static class ReportDataSource { public static IEnumerable<int> ReportData() { List<int> iList = new List<int>(); iList.Add(2); iList.Add(3); iList.Add(5); iList.Add(7); return iList; } } }
But when we start the wizard and select this new class...: