Example #1
0
        /// <summary>
        /// Calculate the hash value for the data area.
        /// </summary>
        /// <param name="key">A key to calculate the hash. The default value is an empty string.</param>
        /// <param name="treatZeroAsNa">If true, the hash calculation will produce the same hash values for #NA and zero, or #NA and empty string for text cells.</param>
        /// <returns>A unique hash value for the data area.</returns>
        public string CalculateHash(string key, bool treatZeroAsNa)
        {
            MdsSetValueProlog();

            string result = NativeOlapApi.DataAreaCalculateHash(_cube.Server.Store.ClientSlot, _cube.Server.ServerHandle, _parameters, key, _cube.Server.LastErrorInternal);

            if (_cube.Server.LastErrorInternal.Value != 0)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("The hash value could not be calculated!");
                sb.Append(", Error: ");
                sb.Append(System.Convert.ToString(_cube.Server.LastErrorInternal.Value));
                sb.Append(", ");
                sb.Append(ToString());
                throw new OlapException(sb.ToString(), _cube.Server.LastErrorInternal.Value);
            }

            MdsSetValueEpilog();
            _isActivated = false;
            _cube.Server.DataAreaActive.Value = false;

            return(result);
        }