Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 16 Apr 2024, 15:30

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Catch PivotFields Values
PostPosted: 17 Jul 2020, 20:25 
Offline

Joined: 24 Aug 2018, 13:15
Posts: 46
Location: Brazil
Is it possible to get the value that appears in the grid, as shown in the image below?

Image


Top
 Profile  
 
PostPosted: 21 Jul 2020, 14:18 
Offline

Joined: 24 Aug 2018, 13:15
Posts: 46
Location: Brazil
up


Top
 Profile  
 
PostPosted: 23 Jul 2020, 23:31 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

You can access

TPivotGridEh.VisPivotGridArray property
or protected TPivotGridEh.PivotGridArray array property to access PivotGrid values.

VisPivotGridArray[c, r] - return grid cell from visible (expanded pivot Rows and Columns) cell array.

PivotGridArray[c, r] - return grid cell from Full cell array.

TPivotCellEh have CelType and Value property.
CelType in [sctDataEh, sctHorzAggregateData, sctVertAggregateData] - cells in Data 'White' area.

Here is example to get values from VisPivotGridArray


Code:
type
  TPivotGridEhCrack = class(TPivotGridEh);

procedure TForm1.Button1Click(Sender: TObject);
var
  ACell: TPivotCellEh;
  c, r: Integer;
  s: String;
begin
  DBMemoEh1.Clear;

  for r := 0 to TPivotGridEhCrack(PivotGridEh1).FullRowCount - 1 do
  //for r := 0 to Length(TPivotGridEhCrack(PivotGridEh1).PivotGridArray[0]) - 1 do
  begin
    for c := 0 to TPivotGridEhCrack(PivotGridEh1).FullColCount - 1 do
    //for c := 0 to Length(TPivotGridEhCrack(PivotGridEh1).PivotGridArray) - 1 do
    begin
      ACell := PivotGridEh1.VisPivotGridArray[c, r];
      //ACell := TPivotGridEhCrack(PivotGridEh1).PivotGridArray[c, r];
      if (ACell.CelType in [sctDataEh, sctHorzAggregateData, sctVertAggregateData]) then
      begin
        s := s + VarToStr(ACell.Value) + #09;
      end;
    end;
   DBMemoEh1.Lines.Add(s);
   s := '';
  end;
end;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group