Beispiel #1
0
 public DimensionALInterface(ALModel model, RefBTAttribute refAttr)
 {
     this.Model         = model;
     this.BTInterface   = refAttr.ReferencedBTInterface;
     this.Core          = refAttr.ReferencedBTInterface.coreInterface;
     this.Depth         = 1;
     this.RootDimension = this;
     this.Alias         = CalculateAlias(model, refAttr);
     this.ShortName     = CalculateShortName(model, refAttr);
     this.Name          = CalculateName(model, refAttr);
     PrepareAttributes();
 }
Beispiel #2
0
        private void GenerateF2DHistoryCondition(StringBuilder sb, RefBTAttribute attr)
        {
            var max      = BL.LoadBLGenerator.GetMaxValueForHistoryAttribute(attr.ReferencedBLInterface.HistoryAttribute);
            var idColumn = attr.ReferencedBLInterface.Attributes.Single(a => a.IsIdentity);

            sb.Append($"and coalesce({attr.JoinAlias}.{attr.ReferencedBLInterface.HistoryAttribute.Name}, '{max}') = (\n".Indent(1));
            sb.Append($"select min(coalesce(tx.{attr.ReferencedBLInterface.HistoryAttribute.Name}, '{max}'))\n".Indent(2));
            sb.Append($"from {attr.ReferencedBLInterface.FullName} tx\n".Indent(2));
            sb.Append($"where tx.{attr.ReferencedBLAttribute.Name} = {attr.JoinAlias}.{attr.ReferencedBLAttribute.Name}\n".Indent(2));
            if (attr.ParentInterface.IsMandant && attr.ReferencedBLInterface.IsMandant)
            {
                sb.Append($"and tx.Mandant_KNZ = {attr.JoinAlias}.Mandant_KNZ\n".Indent(2));
            }
            // TODO: 99991231 noch durch Typbezogene Werte wie in BL beim Cascade ersetzen!!
            sb.Append($"and coalesce(tx.{attr.ReferencedBLInterface.HistoryAttribute.Name}, '{max}') >= ".Indent(2));
            sb.Append($"coalesce(t.{attr.ParentInterface.blInterface.HistoryAttribute.Name}, '{max}')\n");
            sb.Append(")\n".Indent(1));
        }
Beispiel #3
0
 private void GenerateHistoryCondition(StringBuilder sb, RefBTAttribute attr, BTInterface ifa)
 {
     if (ifa.InterfaceType == CoreInterfaceType.FACT_TABLE &&
         attr.ReferencedBTInterface.InterfaceType == CoreInterfaceType.FACT_TABLE)
     {
         // Beziehung zwischen zwei historisierten Fakt-Tabellen
         GenerateF2FHistoryCondition(sb, attr);
     }
     else if (ifa.InterfaceType == CoreInterfaceType.FACT_TABLE && attr.ReferencedBTInterface.IsHistoryTable)
     {
         // Beziehung zwischen einer historisierten Fakt-Tabelle und eienr historisierten Dimension
         GenerateF2DHistoryCondition(sb, attr);
     }
     else if (attr.ReferencedBTInterface.IsHistoryTable && ifa.IsHistoryTable)
     {
         // Beziehung zwischen zwei historisierten Dimensionen
         GenerateF2DHistoryCondition(sb, attr); // Durch die kaskadierung der Versionen in BL sollte das jetzt gehen.
     }
 }
Beispiel #4
0
 private void GenerateF2FHistoryCondition(StringBuilder sb, RefBTAttribute attr)
 {
     sb.Append($"and t.{attr.ReferencedBLInterface.HistoryAttribute.Name} = {attr.JoinAlias}.{attr.ParentInterface.blInterface.HistoryAttribute.Name}\n".Indent("    "));
 }