Ejemplo n.º 1
0
        private void ReadExtendedPropertiesForRecordField(int fieldIndex, Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef, Microsoft.ReportingServices.ReportIntermediateFormat.RecordField field)
        {
            if (!m_dataReader.ReaderFieldProperties || m_dataSetInstance.GetFieldPropertyCount(fieldIndex) <= 0)
            {
                return;
            }
            FieldInfo orCreateFieldInfo = m_dataSetInstance.GetOrCreateFieldInfo(fieldIndex);

            field.FieldPropertyValues = new List <object>(orCreateFieldInfo.PropertyCount);
            for (int i = 0; i < orCreateFieldInfo.PropertyCount; i++)
            {
                int    propertyIndex = orCreateFieldInfo.PropertyReaderIndices[i];
                string modelInfo     = orCreateFieldInfo.PropertyNames[i];
                try
                {
                    object propertyValue = m_dataReader.GetPropertyValue(fieldIndex, propertyIndex);
                    field.FieldPropertyValues.Add(propertyValue);
                }
                catch (ReportProcessingException_FieldError reportProcessingException_FieldError)
                {
                    if (!orCreateFieldInfo.IsPropertyErrorRegistered(i))
                    {
                        m_odpContext.ErrorContext.Register(ProcessingErrorCode.rsErrorReadingFieldProperty, Severity.Warning, Microsoft.ReportingServices.ReportProcessing.ObjectType.DataSet, m_dataSet.Name, "FieldExtendedProperty", fieldDef.Name.MarkAsModelInfo(), modelInfo.MarkAsModelInfo(), reportProcessingException_FieldError.Message);
                        orCreateFieldInfo.SetPropertyErrorRegistered(i);
                    }
                    field.FieldPropertyValues.Add(null);
                }
            }
        }
Ejemplo n.º 2
0
 internal FieldImpl(ObjectModelImpl reportOM, DataFieldStatus status, string exceptionMessage, Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef)
 {
     m_reportOM = reportOM;
     m_fieldDef = fieldDef;
     Global.Tracer.Assert(status != DataFieldStatus.None, "(DataFieldStatus.None != status)");
     UpdateValue(null, isAggregationField: false, status, exceptionMessage);
 }
Ejemplo n.º 3
0
        internal void SetFields(FieldImpl[] fields, long streamOffset)
        {
            bool flag = m_referenced || streamOffset == DataFieldRow.UnInitializedStreamOffset || m_streamOffset != streamOffset;

            NewRow(streamOffset);
            if (m_collection == null)
            {
                Global.Tracer.Assert(condition: false, "Invalid FieldsImpl.  m_collection should not be null.");
            }
            if (fields == null)
            {
                for (int i = 0; i < m_count; i++)
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef = m_collection[i]?.FieldDef;
                    m_collection[i] = new FieldImpl(m_reportOM, null, isAggregationField: false, fieldDef);
                }
            }
            else if (flag)
            {
                if (fields.Length != m_count)
                {
                    Global.Tracer.Assert(false, "Wrong number of fields during ReportOM update.  Usually this means the data set is wrong.  Expected: {0}.  Actual: {1}", m_count, fields.Length);
                }
                for (int j = 0; j < m_count; j++)
                {
                    m_collection[j] = fields[j];
                }
                m_isAggregateRow        = false;
                m_aggregationFieldCount = m_aggregationFieldCountForDetailRow;
            }
        }
Ejemplo n.º 4
0
        public void Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(m_declaration);
            IScalabilityCache scalabilityCache = reader.PersistenceHelper as IScalabilityCache;

            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.ReportObjectModel:
                {
                    int id2 = reader.ReadInt32();
                    m_reportOM = (ObjectModelImpl)scalabilityCache.FetchStaticReference(id2);
                    break;
                }

                case MemberName.Value:
                    m_value = reader.ReadVariant();
                    break;

                case MemberName.IsAggregateField:
                    m_isAggregationField = reader.ReadBoolean();
                    break;

                case MemberName.AggregationFieldChecked:
                    m_aggregationFieldChecked = reader.ReadBoolean();
                    break;

                case MemberName.FieldStatus:
                    m_fieldStatus = (DataFieldStatus)reader.ReadEnum();
                    break;

                case MemberName.Message:
                    m_exceptionMessage = reader.ReadString();
                    break;

                case MemberName.Properties:
                    m_properties = reader.ReadStringObjectHashtable <Hashtable>();
                    break;

                case MemberName.FieldDef:
                {
                    int id = reader.ReadInt32();
                    m_fieldDef = (Microsoft.ReportingServices.ReportIntermediateFormat.Field)scalabilityCache.FetchStaticReference(id);
                    break;
                }

                case MemberName.UsedInExpression:
                    m_usedInExpression = reader.ReadBoolean();
                    break;

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
        }
        void IPersistable.Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(m_declaration);
            IScalabilityCache scalabilityCache = reader.PersistenceHelper as IScalabilityCache;

            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.FieldDef:
                {
                    int id2 = reader.ReadInt32();
                    m_fieldDef = (Microsoft.ReportingServices.ReportIntermediateFormat.Field)scalabilityCache.FetchStaticReference(id2);
                    break;
                }

                case MemberName.Value:
                    m_value = reader.ReadVariant();
                    break;

                case MemberName.IsValueReady:
                    m_isValueReady = reader.ReadBoolean();
                    break;

                case MemberName.IsVisited:
                    m_isVisited = reader.ReadBoolean();
                    break;

                case MemberName.ReportRuntime:
                {
                    int id = reader.ReadInt32();
                    m_reportRT      = (Microsoft.ReportingServices.RdlExpressions.ReportRuntime)scalabilityCache.FetchStaticReference(id);
                    m_iErrorContext = m_reportRT;
                    break;
                }

                case MemberName.ErrorOccurred:
                    m_errorOccurred = reader.ReadBoolean();
                    break;

                case MemberName.ExceptionMessage:
                    m_exceptionMessage = reader.ReadString();
                    break;

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        private void MapExtendedProperties()
        {
            if (!m_dataReader.ReaderFieldProperties)
            {
                return;
            }
            int count = m_dataSet.Fields.Count;

            for (int i = 0; i < count; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field field = m_dataSet.Fields[i];
                if (field.IsCalculatedField)
                {
                    continue;
                }
                try
                {
                    int           propertyCount = m_dataReader.GetPropertyCount(i);
                    List <int>    list          = new List <int>();
                    List <string> list2         = new List <string>();
                    for (int j = 0; j < propertyCount; j++)
                    {
                        string text = null;
                        try
                        {
                            text = m_dataReader.GetPropertyName(i, j);
                            list.Add(j);
                            list2.Add(text);
                        }
                        catch (ReportProcessingException_FieldError reportProcessingException_FieldError)
                        {
                            m_odpContext.ErrorContext.Register(ProcessingErrorCode.rsErrorReadingFieldProperty, Severity.Warning, Microsoft.ReportingServices.ReportProcessing.ObjectType.DataSet, m_dataSet.Name, "FieldExtendedProperty", field.Name.MarkAsModelInfo(), text.MarkAsModelInfo(), reportProcessingException_FieldError.Message);
                        }
                    }
                    if (list.Count > 0)
                    {
                        if (m_dataSetInstance.FieldInfos == null)
                        {
                            m_dataSetInstance.FieldInfos = new FieldInfo[count];
                        }
                        m_dataSetInstance.FieldInfos[i] = new FieldInfo(list, list2);
                    }
                }
                catch (ReportProcessingException_FieldError aException)
                {
                    HandleFieldError(aException, i, field.Name);
                }
            }
        }
Ejemplo n.º 7
0
        private void PopulateServerAggregateInformationFromIndicatorFields(Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow recordRow)
        {
            int num  = 0;
            int num2 = 0;

            for (int i = 0; i < recordRow.RecordFields.Length; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField = recordRow.RecordFields[i];
                Microsoft.ReportingServices.ReportIntermediateFormat.Field       field       = m_dataSet.Fields[i];
                if (recordField == null || !field.HasAggregateIndicatorField)
                {
                    continue;
                }
                num++;
                Microsoft.ReportingServices.ReportIntermediateFormat.Field field2 = m_dataSet.Fields[field.AggregateIndicatorFieldIndex];
                bool processedValue = false;
                bool flag;
                if (field2.IsCalculatedField)
                {
                    if (field2.Value.Type == Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Constant)
                    {
                        processedValue = field2.Value.BoolValue;
                        flag           = false;
                    }
                    else
                    {
                        flag = !Microsoft.ReportingServices.RdlExpressions.ReportRuntime.TryProcessObjectToBoolean(field2.Value.LiteralInfo.Value, out processedValue);
                    }
                }
                else
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField2 = recordRow.RecordFields[field.AggregateIndicatorFieldIndex];
                    flag = (recordField2 == null || recordField2.FieldStatus != 0 || !Microsoft.ReportingServices.RdlExpressions.ReportRuntime.TryProcessObjectToBoolean(recordField2.FieldValue, out processedValue));
                }
                if (flag)
                {
                    m_odpContext.ErrorContext.Register(ProcessingErrorCode.rsMissingOrInvalidAggregateIndicatorFieldValue, Severity.Warning, Microsoft.ReportingServices.ReportProcessing.ObjectType.Field, field2.Name, "AggregateIndicatorField", m_dataSet.Name.MarkAsPrivate(), field.Name.MarkAsModelInfo());
                }
                else if (processedValue)
                {
                    num2++;
                    recordRow.IsAggregateRow = true;
                }
                recordField.IsAggregationField = !processedValue;
            }
            recordRow.AggregationFieldCount = num - num2;
        }
Ejemplo n.º 8
0
        private void CreateProcessingDataReader(IDataReader reader, DataSourceErrorInspector errorInspector, bool readerExtensionsSupportedLocal)
        {
            List <Microsoft.ReportingServices.ReportIntermediateFormat.Field> fields = m_dataSet.Fields;
            int num = 0;

            if (fields != null)
            {
                num = ((!m_odpContext.IsSharedDataSetExecutionOnly) ? m_dataSet.NonCalculatedFieldCount : m_dataSet.Fields.Count);
            }
            string[] array  = new string[num];
            string[] array2 = new string[num];
            for (int i = 0; i < num; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field field = fields[i];
                array[i]  = field.DataField;
                array2[i] = field.Name;
            }
            m_executionMetrics.StartTimer(DataProcessingMetrics.MetricType.DataReaderMapping);
            m_dataReader = new ProcessingDataReader(m_odpContext, m_dataSetInstance, m_dataSet.Name, reader, readerExtensionsSupportedLocal || m_dataSet.HasAggregateIndicatorFields, array2, array, errorInspector);
            m_executionMetrics.RecordTimerMeasurement(DataProcessingMetrics.MetricType.DataReaderMapping);
        }
Ejemplo n.º 9
0
        internal FieldsContext(ObjectModelImpl reportOM, DataSetCore dataSet, bool addRowIndex, bool noRows)
        {
            List <Microsoft.ReportingServices.ReportIntermediateFormat.Field> fields = dataSet.Fields;
            int        num        = fields?.Count ?? 0;
            FieldsImpl fieldsImpl = new FieldsImpl(reportOM, num, addRowIndex, noRows);

            Initialize(reportOM, fieldsImpl, dataSet, null, null, allFieldsCleared: true, pendingFieldValueUpdate: false, DataFieldRow.UnInitializedStreamOffset);
            for (int i = 0; i < num; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field field = fields[i];
                if (dataSet.ExprHost != null)
                {
                    field.SetExprHost(dataSet.ExprHost, reportOM);
                }
                fieldsImpl.Add(field.Name, null);
            }
            if (addRowIndex)
            {
                fieldsImpl.AddRowIndexField();
            }
        }
Ejemplo n.º 10
0
 internal FieldImpl(ObjectModelImpl reportOM, object value, bool isAggregationField, Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef)
 {
     m_reportOM = reportOM;
     m_fieldDef = fieldDef;
     UpdateValue(value, isAggregationField, DataFieldStatus.None, null);
 }
Ejemplo n.º 11
0
 internal Field(Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef)
 {
     m_fieldDef = fieldDef;
 }
Ejemplo n.º 12
0
        private Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow ConstructRecordRow()
        {
            Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow recordRow = new Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow();
            bool flag  = m_dataReader.ReaderExtensionsSupported && !m_dataSet.HasAggregateIndicatorFields;
            bool flag2 = HasServerAggregateMetadata && (m_dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.False || (m_odpContext.IsSharedDataSetExecutionOnly && m_dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.Auto));

            Microsoft.ReportingServices.ReportIntermediateFormat.RecordField[] array2 = recordRow.RecordFields = new Microsoft.ReportingServices.ReportIntermediateFormat.RecordField[m_dataSet.NonCalculatedFieldCount];
            for (int i = 0; i < array2.Length; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field field = m_dataSet.Fields[i];
                if (!m_dataSetInstance.IsFieldMissing(i))
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField = new Microsoft.ReportingServices.ReportIntermediateFormat.RecordField();
                    try
                    {
                        array2[i] = recordField;
                        recordField.FieldValue = m_dataReader.GetColumn(i);
                        if (flag2)
                        {
                            if (flag)
                            {
                                recordField.IsAggregationField = m_dataReader.IsAggregationField(i);
                            }
                        }
                        else
                        {
                            recordField.IsAggregationField = true;
                        }
                        recordField.FieldStatus = DataFieldStatus.None;
                    }
                    catch (ReportProcessingException_FieldError aException)
                    {
                        recordField = (array2[i] = HandleFieldError(aException, i, field.Name));
                        if (recordField != null && !flag2)
                        {
                            recordField.IsAggregationField = true;
                        }
                    }
                    ReadExtendedPropertiesForRecordField(i, field, recordField);
                }
                else
                {
                    array2[i] = null;
                }
            }
            if (flag2)
            {
                if (flag)
                {
                    recordRow.IsAggregateRow        = m_dataReader.IsAggregateRow;
                    recordRow.AggregationFieldCount = m_dataReader.AggregationFieldCount;
                }
                else
                {
                    PopulateServerAggregateInformationFromIndicatorFields(recordRow);
                }
            }
            else
            {
                recordRow.AggregationFieldCount = m_dataSet.Fields.Count;
            }
            return(recordRow);
        }
 internal CalculatedFieldWrapperImpl(Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef, Microsoft.ReportingServices.RdlExpressions.ReportRuntime reportRT)
 {
     m_fieldDef      = fieldDef;
     m_reportRT      = reportRT;
     m_iErrorContext = reportRT;
 }
Ejemplo n.º 14
0
        private void CreateAndInitializeCalculatedFieldWrapper(ObjectModelImpl reportOM, bool readerExtensionsSupported, DataSetCore dataSet, int fieldIndex, Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef)
        {
            CalculatedFieldWrapperImpl value = new CalculatedFieldWrapperImpl(fieldDef, reportOM.OdpContext.ReportRuntime);
            bool isAggregationField          = (!readerExtensionsSupported) ? true : false;

            if (dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.True)
            {
                isAggregationField = true;
            }
            m_fields[fieldIndex] = new FieldImpl(reportOM, value, isAggregationField, fieldDef);
            if (dataSet.ExprHost != null && fieldDef.ExprHost == null)
            {
                fieldDef.SetExprHost(dataSet.ExprHost, reportOM);
            }
        }
Ejemplo n.º 15
0
        internal void UpdateFieldValues(ObjectModelImpl reportOM, bool useDataSetFieldsCache, bool reuseFieldObjects, Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow row, DataSetInstance dataSetInstance, bool readerExtensionsSupported)
        {
            Global.Tracer.Assert(row != null, "Empty data row / no data reader");
            if (m_dataSetInstance != dataSetInstance)
            {
                m_dataSetInstance = dataSetInstance;
                m_dataSet         = dataSetInstance.DataSetDef.DataSetCore;
                if (m_dataSet.FieldsContext != null && useDataSetFieldsCache)
                {
                    m_fields = m_dataSet.FieldsContext.Fields;
                }
                else
                {
                    reuseFieldObjects = false;
                }
                m_dataReader              = null;
                m_lastRowOffset           = DataFieldRow.UnInitializedStreamOffset;
                m_pendingFieldValueUpdate = false;
            }
            m_allFieldsCleared = false;
            FieldInfo[] fieldInfos = dataSetInstance.FieldInfos;
            if (m_fields.ReaderExtensionsSupported && m_dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.False)
            {
                m_fields.IsAggregateRow        = row.IsAggregateRow;
                m_fields.AggregationFieldCount = row.AggregationFieldCount;
                if (!row.IsAggregateRow)
                {
                    m_fields.AggregationFieldCountForDetailRow = row.AggregationFieldCount;
                }
            }
            int num   = 0;
            int count = m_dataSet.Fields.Count;
            int num2  = row.RecordFields.Length;

            for (num = 0; num < num2; num++)
            {
                FieldImpl fieldImpl = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null;
                Microsoft.ReportingServices.ReportIntermediateFormat.Field       fieldDef    = m_dataSet.Fields[num];
                Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField = row.RecordFields[num];
                if (recordField == null)
                {
                    if (!reuseFieldObjects || fieldImpl == null)
                    {
                        fieldImpl = new FieldImpl(reportOM, DataFieldStatus.IsMissing, null, fieldDef);
                    }
                    else
                    {
                        fieldImpl.UpdateValue(null, isAggregationField: false, DataFieldStatus.IsMissing, null);
                    }
                }
                else if (recordField.FieldStatus == DataFieldStatus.None)
                {
                    if (!reuseFieldObjects || fieldImpl == null)
                    {
                        fieldImpl = new FieldImpl(reportOM, recordField.FieldValue, recordField.IsAggregationField, fieldDef);
                    }
                    else
                    {
                        fieldImpl.UpdateValue(recordField.FieldValue, recordField.IsAggregationField, DataFieldStatus.None, null);
                    }
                }
                else if (!reuseFieldObjects || fieldImpl == null)
                {
                    fieldImpl = new FieldImpl(reportOM, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null), fieldDef);
                }
                else
                {
                    fieldImpl.UpdateValue(null, isAggregationField: false, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null));
                }
                if (recordField != null && fieldInfos != null)
                {
                    FieldInfo fieldInfo = fieldInfos[num];
                    if (fieldInfo != null && fieldInfo.PropertyCount != 0 && recordField.FieldPropertyValues != null)
                    {
                        for (int i = 0; i < fieldInfo.PropertyCount; i++)
                        {
                            fieldImpl.SetProperty(fieldInfo.PropertyNames[i], recordField.FieldPropertyValues[i]);
                        }
                    }
                }
                m_fields[num] = fieldImpl;
            }
            if (num >= count)
            {
                return;
            }
            if (!reuseFieldObjects && reportOM.OdpContext.ReportRuntime.ReportExprHost != null)
            {
                m_dataSet.SetExprHost(reportOM.OdpContext.ReportRuntime.ReportExprHost, reportOM);
            }
            for (; num < count; num++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef2 = m_dataSet.Fields[num];
                FieldImpl fieldImpl2 = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null;
                if (reuseFieldObjects && fieldImpl2 != null)
                {
                    if (!fieldImpl2.ResetCalculatedField())
                    {
                        CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2);
                    }
                }
                else
                {
                    CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2);
                }
            }
        }
Ejemplo n.º 16
0
        private void SetupObjectModels(OnDemandMode mode, bool needDeepCopyPath, int moveNextInstanceIndex, string scopeName)
        {
            Microsoft.ReportingServices.ReportIntermediateFormat.DataRegionInstance dataRegionInstance = null;
            IMemberHierarchy memberHierarchy         = null;
            int                     num              = -1;
            ScopeInstance           scopeInstance    = m_odpContext.CurrentReportInstance;
            List <InstancePathItem> lastInstancePath = m_lastInstancePath;
            List <InstancePathItem> list             = null;
            int                     num2             = 0;

            Microsoft.ReportingServices.ReportIntermediateFormat.Report reportDefinition = m_odpContext.ReportDefinition;
            ObjectModelImpl reportObjectModel = m_odpContext.ReportObjectModel;
            bool            flag  = false;
            bool            flag2 = false;
            int             i     = 0;

            try
            {
                if (m_lastRIFObject.InstancePath != null)
                {
                    list = m_lastRIFObject.InstancePath;
                    num2 = list.Count;
                }
                if (mode != OnDemandMode.InScope)
                {
                    m_odpContext.EnsureCultureIsSetOnCurrentThread();
                }
                if (mode == OnDemandMode.InScope && 1 == reportDefinition.DataSetsNotOnlyUsedInParameters && InScopeCompare(reportDefinition.FirstDataSet.Name, scopeName))
                {
                    return;
                }
                int num3 = 0;
                if (m_odpContext.InSubreport)
                {
                    num3 = InstancePathItem.GetParentReportIndex(m_lastRIFObject.InstancePath, m_lastRIFObject.InstancePathItem.Type == InstancePathItemType.SubReport);
                }
                bool identicalPaths;
                int  sharedPathIndex = InstancePathItem.GetSharedPathIndex(num3, lastInstancePath, list, reportObjectModel.AllFieldsCleared, out identicalPaths);
                for (int j = m_specialLastGroupingValues.Count; j < num3; j++)
                {
                    m_specialLastGroupingValues.Add(null);
                }
                for (int k = num3; k < num2; k++)
                {
                    InstancePathItem instancePathItem = list[k];
                    bool             flag3            = false;
                    if (mode != OnDemandMode.InScope)
                    {
                        flag3 = (k <= sharedPathIndex);
                    }
                    if (!flag3 && mode == OnDemandMode.FullSetup)
                    {
                        if (m_specialLastGroupingValues.Count < num2)
                        {
                            m_specialLastGroupingValues.Add(null);
                        }
                        else
                        {
                            m_specialLastGroupingValues[k] = null;
                        }
                    }
                    switch (instancePathItem.Type)
                    {
                    case InstancePathItemType.SubReport:
                    {
                        if (scopeInstance.SubreportInstances == null || instancePathItem.IndexInCollection >= scopeInstance.SubreportInstances.Count)
                        {
                            break;
                        }
                        IReference <Microsoft.ReportingServices.ReportIntermediateFormat.SubReportInstance> reference = scopeInstance.SubreportInstances[instancePathItem.IndexInCollection];
                        using (reference.PinValue())
                        {
                            Microsoft.ReportingServices.ReportIntermediateFormat.SubReportInstance subReportInstance = reference.Value();
                            subReportInstance.SubReportDef.CurrentSubReportInstance = reference;
                            if (mode != OnDemandMode.InScope && !subReportInstance.Initialized)
                            {
                                if (m_odpContext.IsTablixProcessingMode || m_odpContext.IsTopLevelSubReportProcessing)
                                {
                                    return;
                                }
                                SubReportInitializer.InitializeSubReport(subReportInstance.SubReportDef);
                                reference.PinValue();
                            }
                            Global.Tracer.Assert(k == num2 - 1, "SubReport not last in instance path.");
                        }
                        break;
                    }

                    case InstancePathItemType.DataRegion:
                        if (scopeInstance is Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance && (scopeInstance.DataRegionInstances == null || scopeInstance.DataRegionInstances.Count <= instancePathItem.IndexInCollection || scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection] == null || scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection].Value() == null))
                        {
                            Global.Tracer.Assert(instancePathItem.IndexInCollection < reportDefinition.TopLevelDataRegions.Count, "(newItem.IndexInCollection < m_reportDefinition.TopLevelDataRegions.Count)");
                            Microsoft.ReportingServices.ReportIntermediateFormat.DataSet dataSet = reportDefinition.TopLevelDataRegions[instancePathItem.IndexInCollection].GetDataSet(reportDefinition);
                            if (mode == OnDemandMode.InScope && InScopeCompare(dataSet.Name, scopeName))
                            {
                                return;
                            }
                            PerformOnDemandTablixProcessing(dataSet);
                        }
                        scopeInstance      = scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection].Value();
                        flag               = (m_inRecursiveColumnHierarchy = false);
                        flag2              = (m_inRecursiveRowHierarchy = false);
                        num                = -1;
                        dataRegionInstance = (scopeInstance as Microsoft.ReportingServices.ReportIntermediateFormat.DataRegionInstance);
                        memberHierarchy    = dataRegionInstance;
                        if (mode == OnDemandMode.InScope && InScopeCompare(dataRegionInstance.DataRegionDef.Name, scopeName))
                        {
                            return;
                        }
                        if (dataRegionInstance.DataSetIndexInCollection >= 0 && m_odpContext.CurrentDataSetIndex != dataRegionInstance.DataSetIndexInCollection && mode != OnDemandMode.InScope)
                        {
                            if (!flag3)
                            {
                                Microsoft.ReportingServices.ReportIntermediateFormat.DataSetInstance dataSetInstance = m_odpContext.CurrentReportInstance.GetDataSetInstance(dataRegionInstance.DataSetIndexInCollection, m_odpContext);
                                if (dataSetInstance != null)
                                {
                                    dataSetInstance.SetupEnvironment(m_odpContext, newDataSetDefinition: true);
                                    i = 0;
                                }
                            }
                            else
                            {
                                i = k + 1;
                            }
                        }
                        if (mode == OnDemandMode.InScope)
                        {
                            break;
                        }
                        if (!flag3)
                        {
                            dataRegionInstance.SetupEnvironment(m_odpContext);
                            i = 0;
                            if (dataRegionInstance.NoRows)
                            {
                                dataRegionInstance.DataRegionDef.NoRows = true;
                                dataRegionInstance.DataRegionDef.ResetTopLevelDynamicMemberInstanceCount();
                                return;
                            }
                            dataRegionInstance.DataRegionDef.NoRows = false;
                        }
                        else
                        {
                            i = k + 1;
                        }
                        break;

                    case InstancePathItemType.ColumnMemberInstanceIndexTopMost:
                        scopeInstance = dataRegionInstance;
                        break;

                    case InstancePathItemType.Cell:
                    {
                        if (-1 == num)
                        {
                            num = 0;
                        }
                        IList <Microsoft.ReportingServices.ReportIntermediateFormat.DataCellInstance> cellInstances = memberHierarchy.GetCellInstances(num);
                        if (cellInstances == null)
                        {
                            if (flag2 && flag)
                            {
                                reportObjectModel.ResetFieldValues();
                            }
                        }
                        else
                        {
                            if (cellInstances.Count <= instancePathItem.IndexInCollection)
                            {
                                break;
                            }
                            Microsoft.ReportingServices.ReportIntermediateFormat.DataCellInstance dataCellInstance = cellInstances[instancePathItem.IndexInCollection];
                            if (dataCellInstance != null)
                            {
                                scopeInstance = dataCellInstance;
                                if (!flag3)
                                {
                                    dataCellInstance.SetupEnvironment(m_odpContext, m_odpContext.CurrentDataSetIndex);
                                    i = 0;
                                }
                                else
                                {
                                    i = k + 1;
                                }
                            }
                        }
                        break;
                    }

                    case InstancePathItemType.None:
                        continue;
                    }
                    if (!instancePathItem.IsDynamicMember)
                    {
                        continue;
                    }
                    IList <DataRegionMemberInstance> childMemberInstances = ((IMemberHierarchy)scopeInstance).GetChildMemberInstances(instancePathItem.Type == InstancePathItemType.RowMemberInstanceIndex, instancePathItem.IndexInCollection);
                    if (childMemberInstances == null)
                    {
                        reportObjectModel.ResetFieldValues();
                        return;
                    }
                    int num4 = (k != num2 - 1 || moveNextInstanceIndex < 0 || moveNextInstanceIndex >= childMemberInstances.Count) ? ((instancePathItem.InstanceIndex >= 0) ? instancePathItem.InstanceIndex : 0) : moveNextInstanceIndex;
                    if (num4 >= childMemberInstances.Count)
                    {
                        instancePathItem.ResetContext();
                        num4 = 0;
                    }
                    DataRegionMemberInstance dataRegionMemberInstance = childMemberInstances[num4];
                    if (mode == OnDemandMode.FullSetup)
                    {
                        dataRegionMemberInstance.MemberDef.InstanceCount      = childMemberInstances.Count;
                        dataRegionMemberInstance.MemberDef.CurrentMemberIndex = num4;
                    }
                    scopeInstance        = dataRegionMemberInstance;
                    m_lastRecursiveLevel = dataRegionMemberInstance.RecursiveLevel;
                    Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode memberDef = dataRegionMemberInstance.MemberDef;
                    if (mode == OnDemandMode.InScope && InScopeCompare(memberDef.Grouping.Name, scopeName))
                    {
                        return;
                    }
                    if (instancePathItem.Type == InstancePathItemType.RowMemberInstanceIndex)
                    {
                        memberHierarchy = dataRegionMemberInstance;
                        flag2           = true;
                    }
                    else
                    {
                        num  = dataRegionMemberInstance.MemberInstanceIndexWithinScopeLevel;
                        flag = true;
                    }
                    if (mode == OnDemandMode.FullSetup && !flag3)
                    {
                        dataRegionMemberInstance.SetupEnvironment(m_odpContext, m_odpContext.CurrentDataSetIndex);
                        i = 0;
                        Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = memberDef.Grouping;
                        if (grouping.Parent != null)
                        {
                            if (memberDef.IsColumn)
                            {
                                m_inRecursiveColumnHierarchy = true;
                            }
                            else
                            {
                                m_inRecursiveRowHierarchy = true;
                            }
                            if (memberDef.IsTablixMember)
                            {
                                memberDef.SetMemberInstances(childMemberInstances);
                                memberDef.SetRecursiveParentIndex(dataRegionMemberInstance.RecursiveParentIndex);
                                memberDef.SetInstanceHasRecursiveChildren(dataRegionMemberInstance.HasRecursiveChildren);
                            }
                        }
                        else if (memberDef.IsColumn)
                        {
                            m_inRecursiveColumnHierarchy = false;
                        }
                        else
                        {
                            m_inRecursiveRowHierarchy = false;
                        }
                        grouping.RecursiveLevel = m_lastRecursiveLevel;
                        grouping.SetGroupInstanceExpressionValues(dataRegionMemberInstance.GroupExprValues);
                        if (mode != 0 || grouping == null || grouping.GroupExpressions == null || grouping.GroupExpressions.Count <= 0)
                        {
                            continue;
                        }
                        Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo expressionInfo = grouping.GroupExpressions[0];
                        if (expressionInfo.Type != Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Field)
                        {
                            continue;
                        }
                        Microsoft.ReportingServices.ReportIntermediateFormat.Field field = memberDef.DataRegionDef.GetDataSet(reportDefinition).Fields[expressionInfo.IntValue];
                        if (field.DataField != null)
                        {
                            string dataField = field.DataField;
                            object second    = dataRegionMemberInstance.GroupExprValues[0];
                            PairObj <string, object> pairObj = m_specialLastGroupingValues[k];
                            if (pairObj == null)
                            {
                                pairObj = new PairObj <string, object>(dataField, second);
                                m_specialLastGroupingValues[k] = pairObj;
                            }
                            else
                            {
                                pairObj.First  = dataField;
                                pairObj.Second = second;
                            }
                        }
                    }
                    else
                    {
                        i = k + 1;
                    }
                }
                if (mode == OnDemandMode.FullSetup && !identicalPaths && scopeInstance != null && i > 0)
                {
                    for (; i < m_lastInstancePath.Count; i++)
                    {
                        if (m_lastInstancePath[i].IsScope)
                        {
                            scopeInstance.SetupFields(m_odpContext, m_odpContext.CurrentDataSetIndex);
                            break;
                        }
                    }
                }
                if (mode != 0 || m_odpContext.IsTablixProcessingMode || m_odpContext.CurrentReportInstance == null || dataRegionInstance != null || reportDefinition.DataSetsNotOnlyUsedInParameters != 1)
                {
                    return;
                }
                Microsoft.ReportingServices.ReportIntermediateFormat.DataSet         firstDataSet     = reportDefinition.FirstDataSet;
                Microsoft.ReportingServices.ReportIntermediateFormat.DataSetInstance dataSetInstance2 = m_odpContext.CurrentReportInstance.GetDataSetInstance(firstDataSet, m_odpContext);
                if (dataSetInstance2 != null)
                {
                    bool flag4 = true;
                    if (!m_odpContext.IsTablixProcessingComplete(firstDataSet.IndexInCollection))
                    {
                        PerformOnDemandTablixProcessing(firstDataSet);
                        flag4 = false;
                    }
                    if (m_odpContext.CurrentOdpDataSetInstance == dataSetInstance2)
                    {
                        flag4 = false;
                    }
                    if (flag4)
                    {
                        dataSetInstance2.SetupEnvironment(m_odpContext, newDataSetDefinition: true);
                    }
                    else if (!dataSetInstance2.NoRows)
                    {
                        dataSetInstance2.SetupFields(m_odpContext, dataSetInstance2);
                    }
                }
            }
            finally
            {
                if (needDeepCopyPath)
                {
                    InstancePathItem.DeepCopyPath(list, ref m_lastInstancePath);
                }
            }
        }