Ejemplo n.º 1
0
 /// <summary>
 /// Update calculationItem associated with the Table object.
 /// </summary>
 /// <param name="tomCalculationItemSource">Tabular Object Model CalculationItem object from the source tabular model to be abstracted in the target.</param>
 public void UpdateCalculationItem(Tom.CalculationItem tomCalculationItemSource)
 {
     if (_calculationItems.ContainsName(tomCalculationItemSource.Name))
     {
         DeleteCalculationItem(tomCalculationItemSource.Name);
     }
     CreateCalculationItem(tomCalculationItemSource);
 }
Ejemplo n.º 2
0
 public void AddCalculationItem(CalculationGroup calcGroup, Tom.CalculationItem tomCalcItem)
 {
     Dax.Metadata.CalculationItem calcItem = new CalculationItem(calcGroup)
     {
         ItemExpression         = DaxExpression.GetExpression(tomCalcItem.Expression),
         FormatStringDefinition = DaxExpression.GetExpression(tomCalcItem.FormatStringDefinition?.Expression),
         ItemName                 = new Dax.Metadata.DaxName(tomCalcItem.Name),
         State                    = tomCalcItem.State.ToString(),
         ErrorMessage             = tomCalcItem.ErrorMessage,
         FormatStringState        = tomCalcItem.FormatStringDefinition?.State.ToString(),
         FormatStringErrorMessage = tomCalcItem.FormatStringDefinition?.ErrorMessage
     };
     calcGroup.CalculationItems.Add(calcItem);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Create calculationItem associated with the Table object.
        /// </summary>
        /// <param name="tomCalculationItemSource">Tabular Object Model CalculationItem object from the source tabular model to be abstracted in the target.</param>
        public void CreateCalculationItem(Tom.CalculationItem tomCalculationItemSource)
        {
            if (_tomTable.CalculationGroup.CalculationItems.ContainsName(tomCalculationItemSource.Name))
            {
                _tomTable.CalculationGroup.CalculationItems.Remove(tomCalculationItemSource.Name);
            }

            Tom.CalculationItem tomCalculationItemTarget = new Tom.CalculationItem();
            tomCalculationItemSource.CopyTo(tomCalculationItemTarget);
            _tomTable.CalculationGroup.CalculationItems.Add(tomCalculationItemTarget);

            // shell model
            _calculationItems.Add(new CalculationItem(this, tomCalculationItemTarget));
        }
 /// <summary>
 /// Initializes a new instance of the CalculationItem class using multiple parameters.
 /// </summary>
 /// <param name="parentTable">Table object that the calculationItem belongs to.</param>
 /// <param name="tomCalculationItem">Tabular Object Model CalculationItem object abtstracted by the CalculationItem class.</param>
 /// <param name="isKpi">Indicates whether the calculationItem is a KPI.</param>
 public CalculationItem(Table parentTable, Tom.CalculationItem tomCalculationItem) : base(tomCalculationItem)
 {
     _parentTable        = parentTable;
     _tomCalculationItem = tomCalculationItem;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the CalculationItem class using multiple parameters.
 /// </summary>
 /// <param name="parentTable">Table object that the calculationItem belongs to.</param>
 /// <param name="tomCalculationItem">Tabular Object Model CalculationItem object abtstracted by the CalculationItem class.</param>
 /// <param name="isKpi">Indicates whether the calculationItem is a KPI.</param>
 public CalculationItem(Table parentTable, Tom.CalculationItem tomCalculationItem) : base(tomCalculationItem, parentTable.ParentTabularModel)
 {
     _parentTable        = parentTable;
     _tomCalculationItem = tomCalculationItem;
 }