コード例 #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);
 }
コード例 #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);
 }
コード例 #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));
        }
コード例 #4
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        = parentTable;
     _tomCalculationItem = tomCalculationItem;
 }
コード例 #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;
 }