/// <summary>
        /// Returns cell mapping values
        /// </summary>
        /// <param name="selectedTableInfo"></param>
        /// <param name="rowIndex"></param>
        /// <param name="colIndex"></param>
        /// <returns></returns>
        public Mapping GetCellMapping(int rowIndex, int colIndex, Database dbDatabase)
        {
            Mapping RetVal = null;

            Mapping            ColumnMapping;
            Mapping            RowMapping;
            int                SGValNID = -1;
            List <string>      SGNIds   = new List <string>();
            DI6SubgroupBuilder DI6SGBuilder;

            try
            {
                // Get mapping information

                if (rowIndex >= 0 && colIndex >= 0)
                {
                    ColumnMapping = this.ColumnsMapping[colIndex].Mappings.CellMap;
                    RowMapping    = this.RowsMapping[rowIndex].Mappings.CellMap;

                    // Step1: copy column mapping
                    RetVal = ColumnMapping.Copy();

                    // Step2: set the blank mapping value with the values available in row's mapping
                    RetVal.ReplaceEmptyValues(RowMapping);

                    // Step3: IF SubgoupVal is empty then get subgroupval on the basis of column's subgroups NID + row's subgroups NID
                    if (string.IsNullOrEmpty(RetVal.SubgroupVal))
                    {
                        DI6SGBuilder = new DI6SubgroupBuilder(dbDatabase.DBConnection, dbDatabase.DBQueries);

                        // Step 3a: get subgroup nids(dimensionvalues nid)
                        this.AddSubgroupNIds(DI6SGBuilder, RetVal.Subgroups, SGNIds);
                        this.AddSubgroupNIds(DI6SGBuilder, RowMapping.Subgroups, SGNIds);

                        if (SGNIds.Count > 0)
                        {
                            // Step 3b: get subgroupval for the selected dimensions
                            DI6SubgroupValBuilder SGValBuilder = new DI6SubgroupValBuilder(dbDatabase.DBConnection, dbDatabase.DBQueries);
                            DI6SubgroupValInfo    SGValInfo;

                            SGValNID = SGValBuilder.GetSubgroupValNIdBySugbroups(SGNIds);

                            if (SGValNID > 0)
                            {
                                SGValInfo             = SGValBuilder.GetSubgroupValInfo(FilterFieldType.NId, SGValNID.ToString());
                                RetVal.SubgroupVal    = SGValInfo.Name;
                                RetVal.SubgroupValGID = SGValInfo.GID;
                            }
                        }
                    }

                    // Step 4: set the blank mapping value with the values available in Default mapping
                    RetVal.ReplaceEmptyValues(this._DefaultMapping);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }

            return(RetVal);
        }