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)) { IntersectJoinInfo.RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet); return(false); } Relationship activeRelationship = base.GetActiveRelationship(ourDataSet, parentDataSet); if (activeRelationship == null) { IntersectJoinInfo.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); }
public 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 (!DataScopeInfo.TryGetInnermostParentScopeRelatedToTargetDataSet(targetDataSet, iRIFReportIntersectionScope.ParentRowReportScope, out targetScope)) { return(DataScopeInfo.TryGetInnermostParentScopeRelatedToTargetDataSet(targetDataSet, iRIFReportIntersectionScope.ParentColumnReportScope, out targetScope)); } return(true); } candidate = candidate.ParentReportScope; } targetScope = null; return(false); }
public 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"); this.m_parentDataSet = parentDataSets.ParentDataSet; if (DataSet.AreEqualById(ourDataSet, this.m_parentDataSet)) { return(false); } bool flag = false; if (base.m_relationships != null) { foreach (IdcRelationship relationship in base.m_relationships) { flag |= relationship.ValidateLinearRelationship(errorContext, this.m_parentDataSet); } } if (!flag && !ourDataSet.HasDefaultRelationship(this.m_parentDataSet)) { this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope); return(false); } Relationship activeRelationship = this.GetActiveRelationship(ourDataSet); if (activeRelationship == null) { this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope); return(false); } if (activeRelationship.IsCrossJoin && (!activeRelationship.NaturalJoin || LinearJoinInfo.ScopeHasParentGroups(currentScope, scopeTree))) { errorContext.Register(ProcessingErrorCode.rsInvalidNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, currentScope.Name, "JoinConditions"); return(false); } return(true); }