Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 21:26

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 20 Jan 2021, 20:19 
Offline

Joined: 20 Jan 2021, 20:12
Posts: 4
Hi,

can i get recursive all parentnodes ID`s up to the Mainnode?

kind regards
christian


Top
 Profile  
 
PostPosted: 21 Jan 2021, 08:59 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
Hello jedimen

Do you use TMemTableEh.TreeList mode?

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 21 Jan 2021, 11:52 
Offline

Joined: 20 Jan 2021, 20:12
Posts: 4
Yes, im using the TreeMode.

I`m using this code.

Code:
  id := MemTableEh1.FieldByName('id').AsInteger;
  parent := MemTableEh1.FieldByName('parent').AsInteger;
  s := '|' + inttostr(parent) + '|';

  while parent > 1  do
  begin

    for i := 0 to MemTableEh1.RecordsView.MemoryTreeList.AccountableCount-1 do
    begin
      RecView := MemTableEh1.RecordsView.MemoryTreeList.AccountableItem[i];
      id := RecView.Rec.DataValues['id', dvvValueEh];
      if (id = parent) and (parent > 1)   then
      begin
        parent := RecView.Rec.DataValues['PARENT', dvvValueEh];
        if (parent > 1) then s := s + inttostr(parent) + '|';
        break;
      end;

    end;

  end;


Or can I get directly access to a array?

kind regards
christian


Top
 Profile  
 
PostPosted: 21 Jan 2021, 13:13 
Offline

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

Quote:
can i get recursive all parentnodes ID`s up to the Mainnode?


If you have reference to TMemRecViewEh like RecView := MemTableEh1.RecView;
then you can access Parent RecView using property RecView.NodeParent.

you can read information about properties and methods that can be used when working with a tree in the
"<EhLib Archive>\Hlp\ENG\EhLib Users Guide.doc" file in the "Storing records in tree mode (TreeView)" section.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 21 Jan 2021, 16:27 
Offline

Joined: 20 Jan 2021, 20:12
Posts: 4
Thx


Top
 Profile  
 
PostPosted: 21 Jan 2021, 16:47 
Offline

Joined: 20 Jan 2021, 20:12
Posts: 4
Perfect, so much faster!

Code:
procedure TForm1.Button4Click(Sender: TObject);
var
  RecView: TMemRecViewEh;
  s: string;
begin
  RecView := MemTableEh1.RecView;
  while RecView <> MemTableEh1.RecordsView.MemoryTreeList.Root do
  begin
    s:=s + '|'  + VarToStr(RecView.Rec.DataValues['id', dvvValueEh]);
    RecView := RecView.NodeParent;
  end;

  edit1.text := s;
end;


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 10 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:  
cron
Powered by phpBB® Forum Software © phpBB Group