起步软件技术论坛-X3

 找回密码
 立即注册
搜索
楼主: dupit

透视数据集定义SQL 报错?**

[复制链接]
发表于 2009-5-11 17:34:33 | 显示全部楼层
我12楼的效果例子代码,你对照看看

procedure TZXZDsqlBG.Button2Click(Sender: TObject);
begin
  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).Close;
  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.BeginUpdate;

  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.DimensionDefs.Clear;
  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.SummaryDefs.Clear;

  with TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.DimensionDefs.Add do
  begin
    TableName := 'CSGZB';
    FieldType := TFieldType.ftString;
    FieldName := 'RYID';
    DisPlayName := '人员ID';
    IsPrimaryKey := True;
    IsAgg := False;
    DimStyleDefType := TDecisionDimStyleDefType.dfRowDim;
    DimType := TDecisionDimType.dtDataDim;
    ShowSubTotal := False;
    CustomDim.FieldType := TCustomDimType.cdtString;
    BinType := TBinType.binNone;
  end;
  with TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.DimensionDefs.Add do
  begin
    TableName := 'CSGZB';
    FieldType := TFieldType.ftDate;
    FieldName := 'RQ';
    DisPlayName := '日期';
    IsPrimaryKey := False;
    IsAgg := False;
    DimStyleDefType := TDecisionDimStyleDefType.dfRowDim;
    DimType := TDecisionDimType.dtDataDim;
    ShowSubTotal := False;
    CustomDim.FieldType := TCustomDimType.cdtString;
    BinType := TBinType.binNone;
  end;
  with TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.DimensionDefs.Add do
  begin
    TableName := 'CSGZB';
    FieldType := TFieldType.ftString;
    FieldName := 'GZLX';
    DisPlayName := '工资类型';
    IsPrimaryKey := False;
    IsAgg := False;
    DimStyleDefType := TDecisionDimStyleDefType.dfColDim;
    DimType := TDecisionDimType.dtDataDim;
    ShowSubTotal := False;
    CustomDim.FieldType := TCustomDimType.cdtString;
    BinType := TBinType.binNone;
  end;
  with TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.SummaryDefs.Add do
  begin
    TableName := 'CSGZB';
    FieldType := TFieldType.ftString;
    FieldName := 'JE';
    DisPlayName := '金额';
    IsPrimaryKey := False;
    IsAgg := False;
    SummType := TDecisionSummType.dtDataSumm;
    SummFlags := TSummFlags.sfSum;
  end;

  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).DecisionDef.EndUpdate;
  TPivotDataSet(DataSetBrokerTSSJJ1.DataSet).Open;
end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-5-18 14:00:32 | 显示全部楼层
问题已解决 结贴
回复 支持 反对

使用道具 举报

发表于 2009-5-18 14:10:49 | 显示全部楼层
你那边后来具体是什么原因呢,楼主共享下吧。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-21 05:51 , Processed in 0.037750 second(s), 13 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表