Measure calc dependencies fixes

This commit is contained in:
Christian Wade 2017-12-07 13:04:03 -08:00
parent 88dc332767
commit d6a50a5c2e
7 changed files with 49 additions and 9 deletions

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.19")] [assembly: AssemblyVersion("4.0.0.20")]
[assembly: AssemblyFileVersion("4.0.0.19")] [assembly: AssemblyFileVersion("4.0.0.20")]

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.19")] [assembly: AssemblyVersion("4.0.0.20")]
[assembly: AssemblyFileVersion("4.0.0.19")] [assembly: AssemblyFileVersion("4.0.0.20")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.19")] [assembly: AssemblyVersion("4.0.0.20")]
[assembly: AssemblyFileVersion("4.0.0.19")] [assembly: AssemblyFileVersion("4.0.0.20")]

View File

@ -85,7 +85,9 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
if (openSquareBracketPosition < closeSquareBracketPosition - 1) if (openSquareBracketPosition < closeSquareBracketPosition - 1)
{ {
string potentialDependency = whatsRemainingOfLine.Substring(openSquareBracketPosition + 1, closeSquareBracketPosition - openSquareBracketPosition - 1); string potentialDependency = whatsRemainingOfLine.Substring(openSquareBracketPosition + 1, closeSquareBracketPosition - openSquareBracketPosition - 1);
if (!potentialDependency.Contains('"') && !dependencies.Contains(potentialDependency)) if (!potentialDependency.Contains('"') &&
!_tomMeasure.Expression.Contains($"\"{potentialDependency}\"") && //it's possible the measure itself is deriving the column name from an ADDCOLUMNS for example
!dependencies.Contains(potentialDependency))
{ {
//unbelievable: some genius at m$ did a replace on ] with ]] //unbelievable: some genius at m$ did a replace on ] with ]]
dependencies.Add(potentialDependency); dependencies.Add(potentialDependency);
@ -106,7 +108,7 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
foreach (Table table in _parentTable.ParentTabularModel.Tables) foreach (Table table in _parentTable.ParentTabularModel.Tables)
{ {
//Check if another measure or column has same name //Check if another measure or column has same name
if (table.Measures.ContainsName(dependency) || table.TomTable.Columns.ContainsName(dependency)) if (table.Measures.ContainsNameCaseInsensitive(dependency) || table.ColumnsContainsNameCaseInsensitive(dependency))
{ {
foundDependency = true; foundDependency = true;
break; break;

View File

@ -42,6 +42,23 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
return false; return false;
} }
/// <summary>
/// A Boolean specifying whether the collection contains object by name searching without case sensitivity.
/// </summary>
/// <param name="name"></param>
/// <returns>True if the object is found, or False if it's not found.</returns>
public bool ContainsNameCaseInsensitive(string name)
{
foreach (Measure measure in this)
{
if (measure.Name.ToUpper() == name.ToUpper())
{
return true;
}
}
return false;
}
/// <summary> /// <summary>
/// Returns a collection of Measure objects filtered by the parent table's name. /// Returns a collection of Measure objects filtered by the parent table's name.
/// </summary> /// </summary>

View File

@ -405,6 +405,27 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
#endregion #endregion
#region Other public methods
/// <summary>
/// A Boolean specifying whether the table contains a column with the same name searching without case sensitivity.
/// </summary>
/// <param name="columnName">The name of the column being searched for.</param>
/// <returns>True if the object is found, or False if it's not found.</returns>
public bool ColumnsContainsNameCaseInsensitive(string columnName)
{
foreach (Column column in _tomTable.Columns)
{
if (column.Name.ToUpper() == columnName.ToUpper())
{
return true;
}
}
return false;
}
#endregion
public override string ToString() => this.GetType().FullName; public override string ToString() => this.GetType().FullName;
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> <PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata> <Metadata>
<Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.0.19" Language="en-US" Publisher="BISM Normalizer" /> <Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.0.20" Language="en-US" Publisher="BISM Normalizer" />
<DisplayName>BISM Normalizer</DisplayName> <DisplayName>BISM Normalizer</DisplayName>
<Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description> <Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description>
<MoreInfo>http://bism-normalizer.com/</MoreInfo> <MoreInfo>http://bism-normalizer.com/</MoreInfo>