Code:OLAP Radar: Różnice pomiędzy wersjami

Z Motława
(Nowa strona: == Procedura do HierCube == function CalcTrendByCol(Args: TSubFunctionCalculatorArgs; out Res: Double; TrendVer: Integer): Boolean; var Node: TLabelNode; Nodes: TLabelNodes...)
 
(Procedura do HierCube)
Linia 1: Linia 1:
 
== Procedura do [[HierCube]] ==
 
== Procedura do [[HierCube]] ==
  
function CalcTrendByCol(Args: TSubFunctionCalculatorArgs; out Res: Double; TrendVer: Integer): Boolean;
+
<source lang=pascal>
var
+
function CalcTrendByCol(Args: TSubFunctionCalculatorArgs; out Res: Double; TrendVer: Integer): Boolean;
  Node: TLabelNode;
+
var
  Nodes: TLabelNodes;
+
  Node: TLabelNode;
  i: Integer;
+
  Nodes: TLabelNodes;
  CurrCell, PrevCell: PDataCell;
+
  i: Integer;
  x0, x1: Double;
+
  CurrCell, PrevCell: PDataCell;
begin
+
  x0, x1: Double;
  { by default return empty cell }
+
begin
  Result := False;
+
  { by default return empty cell }
  with Args do
+
  Result := False;
  begin
+
  with Args do
//if not FunctionData[ColTreeIndex, RowTreeIndex].NotEmpty then Exit;
+
  begin
CurrCell := FunctionData[ColTreeIndex, RowTreeIndex];
+
    //if not FunctionData[ColTreeIndex, RowTreeIndex].NotEmpty then Exit;
if CurrCell.NotEmpty then
+
    CurrCell := FunctionData[ColTreeIndex, RowTreeIndex];
begin
+
    if CurrCell.NotEmpty then
  x1 := CurrCell.Data;
+
    begin
  if x1 = 0.0 then Exit;
+
      x1 := CurrCell.Data;
end
+
      if x1 = 0.0 then Exit;
else
+
    end
  Exit;
+
    else
if RowLabelNode = nil then Exit;
+
      Exit;
{ find the parent node of RowLabelNode }
+
    if RowLabelNode = nil then Exit;
Node := RowLabelNode;
+
    { find the parent node of RowLabelNode }
{ for the most total node return empty value }
+
    Node := RowLabelNode;
if Node = nil then Exit;
+
    { for the most total node return empty value }
{ the list of all nodes from the area of adequate comparisons including the given one }
+
    if Node = nil then Exit;
if Node.IsSubTotal then Exit;
+
    { the list of all nodes from the area of adequate comparisons including the given one }
if (Node.Parent <> nil) and Node.Parent.IsSubTotal then Exit;
+
    if Node.IsSubTotal then Exit;
Nodes := Node.LabelNodes;
+
    if (Node.Parent <> nil) and Node.Parent.IsSubTotal then Exit;
{ find previous cells from the area of adequate comparisons }
+
    Nodes := Node.LabelNodes;
i := Node.Index - 1;
+
    { find previous cells from the area of adequate comparisons }
if i >= 0 then
+
    i := Node.Index - 1;
begin
+
    if i >= 0 then
  Node := Nodes[i];
+
    begin
  if not Node.IsSubTotal then
+
      Node := Nodes[i];
  begin
+
      if not Node.IsSubTotal then
PrevCell := FunctionData[ColTreeIndex, Node.TreeIndex]; // RowTreeIndex
+
      begin
if PrevCell.NotEmpty then
+
        PrevCell := FunctionData[ColTreeIndex, Node.TreeIndex]; // RowTreeIndex
begin
+
        if PrevCell.NotEmpty then
  Result := True;
+
        begin
  x0 := PrevCell.Data;
+
          Result := True;
  case TrendVer of
+
          x0 := PrevCell.Data;
1: Res := (1 - x0/x1) * 100;
+
          case TrendVer of
2: Res := x0/x1 * 100;
+
            1: Res := (1 - x0/x1) * 100;
  end;
+
            2: Res := x0/x1 * 100;
end;
+
          end;
  end;
+
        end;
end;
+
      end;
  end;
+
    end;
end;
+
  end;
 
+
end;
 
+
</source>
 
+
 
+
  
  
 
[[Kategoria: System]]
 
[[Kategoria: System]]
 
[[Kategoria: Programowanie]]
 
[[Kategoria: Programowanie]]

Wersja z 14:20, 20 mar 2009

Procedura do HierCube

function CalcTrendByCol(Args: TSubFunctionCalculatorArgs; out Res: Double; TrendVer: Integer): Boolean;
var
  Node: TLabelNode;
  Nodes: TLabelNodes;
  i: Integer;
  CurrCell, PrevCell: PDataCell;
  x0, x1: Double;
begin
  { by default return empty cell }
  Result := False;
  with Args do
  begin
    //if not FunctionData[ColTreeIndex, RowTreeIndex].NotEmpty then Exit;
    CurrCell := FunctionData[ColTreeIndex, RowTreeIndex];
    if CurrCell.NotEmpty then
    begin
      x1 := CurrCell.Data;
      if x1 = 0.0 then Exit;
    end
    else
      Exit;
    if RowLabelNode = nil then Exit;
    { find the parent node of RowLabelNode }
    Node := RowLabelNode;
    { for the most total node return empty value }
    if Node = nil then Exit;
    { the list of all nodes from the area of adequate comparisons including the given one }
    if Node.IsSubTotal then Exit;
    if (Node.Parent <> nil) and Node.Parent.IsSubTotal then Exit;
    Nodes := Node.LabelNodes;
    { find previous cells from the area of adequate comparisons }
    i := Node.Index - 1;
    if i >= 0 then
    begin
      Node := Nodes[i];
      if not Node.IsSubTotal then
      begin
        PrevCell := FunctionData[ColTreeIndex, Node.TreeIndex]; // RowTreeIndex
        if PrevCell.NotEmpty then
        begin
          Result := True;
          x0 := PrevCell.Data;
          case TrendVer of
            1: Res := (1 - x0/x1) * 100;
            2: Res := x0/x1 * 100;
          end;
        end;
      end;
    end;
  end;
end;