zoukankan      html  css  js  c++  java
  • CellSet 遍历

    CellSet 结构:

    查询MDX:

    SELECT  
    NON EMPTY {{  {{ {{ {{  {{ AddCalculatedMembers([店铺.店铺ID].[店铺ID].Members)}}  }} }} }}  
     }}  
    DIMENSION PROPERTIES MEMBER_TYPE
    , [店铺.店铺ID].[店铺ID].[国家], [店铺.店铺ID].[店铺ID].[区域], 
    [店铺.店铺ID].[店铺ID].[省份], [店铺.店铺ID].[店铺ID].[店铺名称]
    
     ON ROWS ,
      {{   [Measures].[终端销售数量],[measures].[终端销售生意额],[measures].[终端销售吊牌额]
           }}
    
       ON COLUMNS
    FROM [RegentCube] 
     where  [日期].[年周].[].&[2015].[第01周]

    C#遍历:

        int pos = 0;
            foreach (Position py in cellSet.Axes[1].Positions)
            {
                dr = dt.NewRow();
    
                //维度描述列数据
                int cols = 0;
                for (int i = 0; i < py.Members.Count; i++)
                {
                    if (i == 0)
                    {
                        for (int w = 1; w < py.Members[0].MemberProperties.Count; w++)
                        {
                            dr[cols] = py.Members[0].MemberProperties[w].Value;
                            cols++;
                        }
                    }
                    else
                    {
                        dr[cols] = py.Members[i].Caption;
                        cols++;
                    }
                }
    
                //数据列
                for (int x = 1; x <= cellSet.Axes[0].Positions.Count; x++)
                {
                    dr[x + cols - 1] = cellSet[pos++].Value;
                }
                dt.Rows.Add(dr);
            }
          var  model = dt.AsEnumerable().Select(r => new
            {
                销售数 = string.IsNullOrWhiteSpace(r["终端销售数量"].ToString()) ? 0 : Convert.ToInt32(r["终端销售数量"]),
                生意额 = string.IsNullOrWhiteSpace(r["终端销售生意额"].ToString()) ? 0 : Convert.ToDouble(r["终端销售生意额"]),
                吊牌额 = string.IsNullOrWhiteSpace(r["终端销售吊牌额"].ToString()) ? 0 : Convert.ToDouble(r["终端销售吊牌额"]),
                国家 = r["Dimension0"],
                省份 = r["Dimension1"],
                城市 = r["Dimension2"],
                店铺名称 = r["Dimension3"]
            });
  • 相关阅读:
    Bacula Plugins
    getopt、getopt_long命令参数
    Notepad++ 快捷键
    make命令
    Linux目录结构
    rhel安装输入法
    libtool编译
    install和cp
    dlopen动态链接库操作
    结构体赋值
  • 原文地址:https://www.cnblogs.com/ycdx2001/p/4402498.html
Copyright © 2011-2022 走看看