Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
Cannot find Object Data Source
posted

Hi,

The problem we are having I believe is very similar to this:

http://www.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[10is System.DBNull ? 0 : (decimal)row[10],
                Period0 = row[11is System.DBNull ? 0 : (decimal)row[11],
                Period1 = row[12is System.DBNull ? 0 : (decimal)row[12],
                Period2 = row[13is System.DBNull ? 0 : (decimal)row[13],
                Period3 = row[14is System.DBNull ? 0 : (decimal)row[14],
                Period4 = row[15is System.DBNull ? 0 : (decimal)row[15],
                Period5 = row[16is System.DBNull ? 0 : (decimal)row[16],
                Period6 = row[17is System.DBNull ? 0 : (decimal)row[17],
                Period7 = row[18is System.DBNull ? 0 : (decimal)row[18],
                Period8 = row[19is System.DBNull ? 0 : (decimal)row[19],
                Period9 = row[20is System.DBNull ? 0 : (decimal)row[20],
                Period10 = row[21is System.DBNull ? 0 : (decimal)row[21],
                Period11 = row[22is System.DBNull ? 0 : (decimal)row[22],
 
            };
 
        }
 
    }
 
    public string Format
    {
        get { return Forecast.Format + ";-"; }
    }