463c2997-8a6a-4688-9575-6549e5215f7b true D0011-SQL-01.sdt.local jazz tst Grady 20191107.1 true <ProgramFilesX64>\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagnostics\Newtonsoft.Json.dll Amazon.Lambda.S3Events AWSSDK.Core AWSSDK.S3 Amazon Amazon.Auth.AccessControlPolicy Amazon.Auth.AccessControlPolicy.ActionIdentifiers Amazon.Internal Amazon.Lambda.S3Events Amazon.MissingTypes Amazon.Runtime Amazon.Runtime.CredentialManagement Amazon.Runtime.CredentialManagement.Internal Amazon.Runtime.EventStreams Amazon.Runtime.EventStreams.Internal Amazon.Runtime.Internal Amazon.Runtime.Internal.Auth Amazon.Runtime.Internal.Settings Amazon.Runtime.Internal.Transform Amazon.Runtime.Internal.Util Amazon.Runtime.SharedInterfaces Amazon.Runtime.SharedInterfaces.Internal Amazon.S3 Amazon.S3.Encryption Amazon.S3.Encryption.Internal Amazon.S3.Internal Amazon.S3.IO Amazon.S3.Model Amazon.S3.Model.Internal.MarshallTransformations Amazon.S3.Transfer Amazon.S3.Util Amazon.Util Amazon.Util.Internal Amazon.Util.Internal.PlatformServices Newtonsoft.Json Newtonsoft.Json.Converters Newtonsoft.Json.Linq Newtonsoft.Json.Schema Newtonsoft.Json.Serialization System System.Diagnostics System.Diagnostics.Tracing System.IO.Compression ThirdParty.BouncyCastle.Asn1 ThirdParty.BouncyCastle.Asn1.Utilities ThirdParty.BouncyCastle.Math ThirdParty.BouncyCastle.OpenSsl ThirdParty.BouncyCastle.Utilities.IO.Pem ThirdParty.Ionic.Zlib ThirdParty.Json.LitJson ThirdParty.MD5 void Main() { var test = (from sd in ScoreDimensions select new StarterSetAdHocScoreDimensionInfo { DimensionGUID = sd.DimensionGUID, FriendlyName = sd.FriendlyName, GlobalID = sd.GlobalID }).ToList(); test.OrderByDescending(t => t.MDXMemberName).Dump(); } // Define other methods and classes here public class StarterSetAdHocScoreDimensionInfo { public Guid DimensionGUID { get; set; } public string FriendlyName { get; set; } public string GlobalID { get; set; } public string AttributeId { get; set; } public string MDXMemberID { get; set; } public bool IsRollup { get; set; } internal Regex ServiceLineRegex = new Regex(@"^Service Line (\d)$", RegexOptions.IgnoreCase); public bool ServiceLineRegexIsMatch => ServiceLineRegex.IsMatch(FriendlyName); public string MDXMemberName { get { try { return AnalysisServicesUtils.GetHierarchyMDXName("Patient Encounter", ServiceLineRegex.IsMatch(FriendlyName) && IsRollup ? $"{ServiceLineRegex.Replace(FriendlyName, "Service Line Rollup ${1}")}" : $"{FriendlyName}{(IsRollup ? " Rollup" : "")}"); } catch (Exception) { return string.Empty; } } } internal string Name => $"Patient Encounter - {FriendlyName}{(IsRollup ? " Rollup" : "")}"; internal StarterSetAdHocScoreDimensionInfo() { MDXMemberID = string.Empty; IsRollup = false; } } public class AnalysisServicesUtils { public static string GetHierarchyMDXName(string aDimensionName, string aHierarchyName) { var s = "[{0}].[{1}]"; return String.Format(s, GetASFriendlyName(aDimensionName), GetASFriendlyName(aHierarchyName)); } public static string GetASFriendlyName(string aStr, bool aTrim = true) { //Invalid characters --> . , ; ' ` : / \ * | ? " & % $ ! + = ( ) [ ] { } //Take out white space var returnStr = System.Text.RegularExpressions.Regex.Replace(aStr, @"[\.,;'`:/\\\*\|\?""&%\$!\+=\(\)\[\]{}]", ""); if (aTrim) returnStr = returnStr.Trim(); //Replace reserved name if (returnStr.Equals("Name", StringComparison.OrdinalIgnoreCase)) returnStr = "Name_"; if (returnStr.Equals("Measures", StringComparison.OrdinalIgnoreCase)) returnStr = "Measures_"; if (returnStr.Equals("ID", StringComparison.OrdinalIgnoreCase)) returnStr = "ID_"; if (returnStr.Equals("Key", StringComparison.OrdinalIgnoreCase)) returnStr = "Key_"; return returnStr; } }