/// <summary> /// Creates a string from a SelectedDimension, formed like "(1, 2, 3, 4) ". Perfect to use for SQL's "IN" operation. /// </summary> /// <param name="selectedDimension"></param> /// <returns></returns> /// <author>Jannik Arndt, Bernd Nottbeck</author> public virtual string ListFilters(SelectedDimension selectedDimension) { List<string> temp = new List<string>(); foreach (DimensionContent dimensionContent in selectedDimension.SelectedFilters) { String content = dimensionContent.Content; //check if apostrophe exists //an apostrophe leads to a problem in the sql statement //because it marks the end of a string instead of be part of the string if (content.Contains("'")) { //make a double quote leads to a valid sql statement content = content.Replace("'", "''"); } temp.Add(content); } return "(" + StringMarker + "" + string.Join("" + StringMarker + ", " + StringMarker + "", temp) + "') "; }
/// <summary> /// Gets the tablename at the selected granularity /// </summary> /// <param name="selectedDimension">The selected dimension (1 or 2)</param> /// <returns>The name of the table</returns> /// <author>Jannik Arndt</author> private string CreateWhereStatements(SelectedDimension selectedDimension) { if (selectedDimension.Dimension == null || selectedDimension.Dimension.DimensionColumnNames.Col_Content == null) return ""; Dimension dimension = selectedDimension.Dimension; // Get dimension at selected granularity if (selectedDimension.LevelDepth > 1 && !selectedDimension.IsAllLevelSelected) for (int i = 1; i < selectedDimension.LevelDepth; i++) dimension = dimension.GetCoarserDimensionLevel()[0]; // Get the table name if (!selectedDimension.IsAllLevelSelected) return TableColumnFormatter(dimension.ToTable, dimension.DimensionColumnNames.Col_Content); return ""; }
/// <summary> /// Add a selected dimension to the event selection model. /// </summary> /// <param Name="selectedDimension"></param> public void AddSelectedDimension(SelectedDimension selectedDimension) { _instance.SelectedDimensions.Add(selectedDimension); }