procedure OpenCloseDim(ADecisionBroker: TDecisionBroker);
var
I: Integer;
lMsg, lDimName: string;
lDS: TDecisionSource;
begin
lMsg := '';
lDS := ADecisionBroker.DecisionSource;
//遍历所有的维,nDims是维的总数
for I := 0 to lDS.nDims - 1 do
begin
//根据“维绝对索引”获取维显示名称
lDimName := lDS.GetDimensionName(I);
//根据“维绝对索引”获取维的状态,并判断是否处于打开状态
if (lDS.GetState(I) = TDimState.dmOpen) then
lMsg := lMsg + 'Close: ' + lDimName + #13#10 else
lMsg := lMsg + 'Open: ' + lDimName + #13#10;
//根据“维索引”来切换维的状态
lDS.ToggleDimIndex(lDS.GetGroup(I), lDS.GetIndex(I, False), False);
end;
jsDialogs.ShowMsg(lMsg, '');
end;
{
用到的枚举类型和方面声明:
TDimState = (dmClosed, dmOpen, dmDrilled, dmPaged, dmNone);
TDimGroup = (dgRow, dgCol, dgSum, dgPage, dgNone);
function TDecisionSource.GetDimensionName(iDim: Integer): String;
function TDecisionSource.GetState(iDim: Integer): TDimState;
function TDecisionSource.GetGroup(iDim: Integer): TDimGroup;
function TDecisionSource.GetIndex(iDim: Integer; bOpen: Boolean): Integer;
procedure TDecisionSource.ToggleDimIndex(dimGroup: TDimGroup; Index: Integer; bOpen: Boolean);
} |