public void ResetFormattedMember(string uniqueName)
        {
            // get hierarchy and member
            Hierarchy hier = _report.Schema.GetHierarchyFromMemberUniqueName(uniqueName);

            if (hier == null)
            {
                throw new Exception("Unable to resolve hierarchy from " + uniqueName);
            }
            DataMember mem = hier.GetMember(uniqueName);

            if (mem == null)
            {
                throw new Exception("Cannot find member: " + uniqueName);
            }

            CalculatedMember cmem = mem as CalculatedMember;
            MemberWrapper    mw   = cmem as MemberWrapper;

            if (mw != null)          // if it's member wrapper, simply replace it with source member
            {
                cmem.Hierarchy.ReplaceMember(mw, mw.SourceMember);
            }
            else if (cmem != null)          // if other calculated member, set default name and format
            {
                CalculatedMember newMem = cmem.Clone(null);
                newMem.Format = CalculatedMember.FormatEnum.Default;
                newMem.Hierarchy.ReplaceMember(cmem, newMem);
            }
        }
        public void SetFormattedMember(string uniqueName, string name, string format)
        {
            // get hierarchy and member
            Hierarchy hier = _report.Schema.GetHierarchyFromMemberUniqueName(uniqueName);

//			// debug
//			if(hier.UniqueName=="[Measures]")
//			{
//				TestFormatMeasure(uniqueName, name, format);
//				return;
//			}

            if (hier == null)
            {
                throw new Exception("Unable to resolve hierarchy from " + uniqueName);
            }
            DataMember mem = hier.GetMember(uniqueName);

            if (mem == null)
            {
                throw new Exception("Cannot find member: " + uniqueName);
            }
            if (mem is Set)
            {
                throw new ArgumentException("Cannot format set: + uniqueName");
            }

            // resolve formatEnum
            CalculatedMember.FormatEnum formatEnum = (CalculatedMember.FormatEnum)Enum.Parse(typeof(CalculatedMember.FormatEnum), format, true);

            // format
            CalculatedMember cmem = mem as CalculatedMember;

            if (cmem != null)          // if calculated member, simply set different name and format
            {
                if (cmem.Name == name && formatEnum == cmem.Format)
                {
                    return;                      // if not changed
                }
                CalculatedMember newMem = cmem.Clone(name);
                newMem.Format = formatEnum;
                cmem.Hierarchy.ReplaceMember(cmem, newMem);
            }
            else             // if data member, create new wrapper
            {
                if (mem.Name == name && formatEnum == CalculatedMember.FormatEnum.Default)
                {
                    return;                      // if not changed
                }
                CalculatedMember newMem = new BusinessObjects.Olap.CalculatedMemberTemplates.MemberWrapper(name, hier, mem);
                newMem.Format = formatEnum;
                newMem.Hierarchy.ReplaceMember(mem, newMem);
            }
        }