public static void SetDAX(this IDaxDependantObject obj, DAXProperty property, string expression) { if (obj is KPI) { if (property == DAXProperty.StatusExpression) { (obj as KPI).StatusExpression = expression; return; } if (property == DAXProperty.TargetExpression) { (obj as KPI).TargetExpression = expression; return; } if (property == DAXProperty.TrendExpression) { (obj as KPI).TrendExpression = expression; return; } } if (obj is IExpressionObject && property == DAXProperty.Expression) { (obj as IExpressionObject).Expression = expression; return; } if (obj is Measure && property == DAXProperty.DetailRowsExpression) { (obj as Measure).DetailRowsExpression = expression; return; } if (obj is Table && property == DAXProperty.DetailRowsExpression) { (obj as Table).DefaultDetailRowsExpression = expression; return; } throw new ArgumentException(string.Format(Messages.InvalidExpressionProperty, obj.GetTypeName(), property), "property"); }
public static void SetDAX(this IDaxDependantObject obj, DAXProperty property, string expression) { if (obj is TablePermission tp && property == DAXProperty.Expression) { tp.FilterExpression = expression; return; } if (obj is KPI) { if (property == DAXProperty.StatusExpression) { (obj as KPI).StatusExpression = expression; return; } if (property == DAXProperty.TargetExpression) { (obj as KPI).TargetExpression = expression; return; } if (property == DAXProperty.TrendExpression) { (obj as KPI).TrendExpression = expression; return; } } if (obj is IExpressionObject && property == DAXProperty.Expression) { (obj as IExpressionObject).Expression = expression; return; } if (obj is Measure && property == DAXProperty.DetailRowsExpression) { (obj as Measure).DetailRowsExpression = expression; return; } if (obj is Table && property == DAXProperty.DefaultDetailRowsExpression) { (obj as Table).DefaultDetailRowsExpression = expression; return; } /*if (obj is Measure m && property == DAXProperty.FormatStringExpression) * { * m.FormatStringExpression = expression; * return; * }*/ if (obj is CalculationItem ci) { if (property == DAXProperty.Expression) { ci.Expression = expression; return; } //if (property == DAXProperty.FormatStringExpression) { ci.FormatStringExpression = expression; return; } } throw new ArgumentException(string.Format(Messages.InvalidExpressionProperty, obj.GetTypeName(), property), "property"); }
public static string GetDAX(this IDaxDependantObject obj, DAXProperty property) { if (obj is KPI) { if (property == DAXProperty.StatusExpression) { return((obj as KPI).StatusExpression); } if (property == DAXProperty.TargetExpression) { return((obj as KPI).TargetExpression); } if (property == DAXProperty.TrendExpression) { return((obj as KPI).TrendExpression); } } if (obj is IExpressionObject && property == DAXProperty.Expression) { return((obj as IExpressionObject).Expression); } if (TabularModelHandler.Singleton.CompatibilityLevel >= 1400) { if (obj is Measure && property == DAXProperty.DetailRowsExpression) { return((obj as Measure).DetailRowsExpression); } if (obj is Table && property == DAXProperty.DetailRowsExpression) { return((obj as Table).DefaultDetailRowsExpression); } } throw new ArgumentException(string.Format(Messages.InvalidExpressionProperty, obj.GetTypeName(), property), "property"); }
public static string GetDAXProperty(this IDaxDependantObject obj, DAXProperty property) { if (obj is TablePermission tp && property == DAXProperty.Expression) { return(Properties.FILTEREXPRESSION); } if (obj is KPI) { if (property == DAXProperty.StatusExpression) { return(Properties.STATUSEXPRESSION); } if (property == DAXProperty.TargetExpression) { return(Properties.TARGETEXPRESSION); } if (property == DAXProperty.TrendExpression) { return(Properties.TRENDEXPRESSION); } } if (obj is IExpressionObject && property == DAXProperty.Expression) { return(Properties.EXPRESSION); } if (obj is CalculationItem ci) { if (property == DAXProperty.Expression) { return(Properties.EXPRESSION); } if (property == DAXProperty.FormatStringExpression) { return(Properties.FORMATSTRINGEXPRESSION); } } if (TabularModelHandler.Singleton.CompatibilityLevel >= 1400) { if (obj is Measure && property == DAXProperty.DetailRowsExpression) { return(Properties.DETAILROWSEXPRESSION); } if (obj is Table && property == DAXProperty.DefaultDetailRowsExpression) { return(Properties.DEFAULTDETAILROWSEXPRESSION); } } /*if (obj is Measure m && property == DAXProperty.FormatStringExpression) * return m.FormatStringExpression;*/ throw new ArgumentException(string.Format(Messages.InvalidExpressionProperty, obj.GetTypeName(), property), "property"); }