private bool HasRelationshipOrDefaultForDataSet(ScopeTree scopeTree, ErrorContext errorContext, IRIFReportDataScope currentScope, DataSet ourDataSet, DataSet parentDataSet, bool hasValidRelationship) { if (DataSet.AreEqualById(parentDataSet, ourDataSet)) { return(true); } if (hasValidRelationship || ourDataSet.HasDefaultRelationship(parentDataSet)) { Relationship activeRelationship = GetActiveRelationship(ourDataSet, parentDataSet); if (activeRelationship == null) { RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet); return(false); } if (activeRelationship.IsCrossJoin) { DataRegion parentDataRegion = scopeTree.GetParentDataRegion(currentScope); errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "JoinConditions", parentDataRegion.ObjectType.ToString()); return(false); } return(true); } RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet); return(false); }
internal override bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope) { Global.Tracer.Assert(parentDataSets != null && parentDataSets.Count == 1, "LinearJoinInfo can only be used with exactly one parent data set"); m_parentDataSet = parentDataSets.ParentDataSet; if (DataSet.AreEqualById(ourDataSet, m_parentDataSet)) { return(false); } bool flag = false; if (m_relationships != null) { foreach (IdcRelationship relationship in m_relationships) { flag |= relationship.ValidateLinearRelationship(errorContext, m_parentDataSet); } } if (flag || ourDataSet.HasDefaultRelationship(m_parentDataSet)) { Relationship activeRelationship = GetActiveRelationship(ourDataSet); if (activeRelationship == null) { RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope); return(false); } if (activeRelationship.IsCrossJoin && (!activeRelationship.NaturalJoin || ScopeHasParentGroups(currentScope, scopeTree))) { errorContext.Register(ProcessingErrorCode.rsInvalidNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, currentScope.Name, "JoinConditions"); return(false); } return(true); } RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope); return(false); }
internal static bool TryGetInnermostParentScopeRelatedToTargetDataSet(DataSet targetDataSet, IRIFReportDataScope candidate, out IRIFReportDataScope targetScope) { while (candidate != null) { if (targetDataSet.HasDefaultRelationship(candidate.DataScopeInfo.DataSet)) { targetScope = candidate; return(true); } if (candidate.IsDataIntersectionScope) { IRIFReportIntersectionScope iRIFReportIntersectionScope = (IRIFReportIntersectionScope)candidate; if (!TryGetInnermostParentScopeRelatedToTargetDataSet(targetDataSet, iRIFReportIntersectionScope.ParentRowReportScope, out targetScope)) { return(TryGetInnermostParentScopeRelatedToTargetDataSet(targetDataSet, iRIFReportIntersectionScope.ParentColumnReportScope, out targetScope)); } return(true); } candidate = candidate.ParentReportScope; } targetScope = null; return(false); }