/// <summary>
        ///		Obtiene la consulta de una dimensión
        /// </summary>
        private QueryModel GetChildQuery(DimensionRequestModel dimensionRequest)
        {
            DimensionModel dimension = GetDimension(dimensionRequest);
            QueryModel     query     = new QueryModel(dimensionRequest.DimensionId, QueryModel.QueryType.Dimension, dimension.Id);

            // Prepara la consulta
            query.Prepare(dimension.DataSource);
            // Añade los campos clave
            foreach (DataSourceColumnModel column in dimension.DataSource.Columns.EnumerateValues())
            {
                if (column.IsPrimaryKey)
                {
                    query.AddPrimaryKey(dimensionRequest.GetRequestColumn(column.Id), column.Id, CheckIsColumnAtColumnRequested(column, dimensionRequest.Columns));
                }
            }
            // Asigna los campos
            foreach (DimensionColumnRequestModel columnRequest in dimensionRequest.Columns)
            {
                DataSourceColumnModel column = dimension.DataSource.Columns[columnRequest.ColumnId];

                if (column != null && !column.IsPrimaryKey)
                {
                    query.AddColumn(columnRequest.ColumnId, columnRequest);
                }
            }
            // Devuelve la consulta
            return(query);
        }
 /// <summary>
 ///		Obtiene los campos de expresiones agrupados
 /// </summary>
 private void ComputeFieldsGrouped(QueryModel query, ReportRequestModel request, BaseDataSourceModel dataSource)
 {
     foreach (ExpressionRequestModel expression in request.Expressions)
     {
         if (expression.ReportDataSourceId == dataSource.Id)
         {
             foreach (ExpressionColumnRequestModel requestColumn in expression.Columns)
             {
                 foreach (DataSourceColumnModel column in dataSource.Columns.EnumerateValues())
                 {
                     if (requestColumn.ColumnId.Equals(column.Id, StringComparison.CurrentCultureIgnoreCase))
                     {
                         query.AddColumn(column.Id, requestColumn.AggregatedBy, requestColumn);
                     }
                 }
             }
         }
     }
 }