一个表有如下字段: 订单序号,型号, 数量, 组件编号, 来源, 物料编号, 中文描述, 需求数。
 
      要求在一个报表格式:有四个分组:第一个分组(订单序号);
                                   第二个分组(型号);
                        
                                   第三个分组(组件编号);
                                   第四个分组(来源);
           
                              
                           

解决方案 »

  1.   

    用master-detail作
    放五个query:one,two,three,four,all
      四个datasouce:dts1——dts4
          dts1对应->one;
          dts2对应->two;two的datasource属性设置为dts1
          dts3->three;three的datasource设置为dts2
          dts4->four的datasource设置为dts3
                all的datasource设置为dts4
      one.sql.text:='select distinct 订单序号 from mytable'
      two.sql.text:='select distinct 型号 from mytable where 订单序号=:订单序号'
      three.sql.text:='select distinct 组件编号 from mytable where 订单序号=:订单序号 and 型号=:型号';
      four.sql.text:='select distinct 来源 from mytable where 订单序号=:订单序号 and 型号=:型号 and 组件编号=:组件编号';
      all.sql.text:='select * from mytable where 订单序号=:订单序号 and 型号=:型号 and 组件编号=:组件编号 and 来源=:来源';
      然后在quickrep上每种分组放置:
         第一个分组(订单序号):one->订单序号
         第二个分组(型号):two->
         第三个分组(组件编号):three->
         第四个分组(来源)four的相应字段
      最后放all的其他字段!!!