Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Listview question.

Avatar of Peter Kiers
Peter KiersFlag for Netherlands asked on
Delphi
2 Comments1 Solution506 ViewsLast Modified:
Dear Experts,

I have a Button, a ListView and a XMLDocument-component on my form.
I have put the Button1Click procedure in the code-section. When I press
on the button it uses the XMLDocument-component to parse the xml-file
that is specified in the procedure. It searches for the nodes that begins with 'BG'  
and displays from every node that begins with BG the values from Val, Dt and TM
into the Listview columns Value, Date and Time.

AND IT WORKS SUPER.

Now I want to add a fourt column called Day and every cell of the column Day
has to look in the cell Date and give the name of the day in the cell.
If you don't know what I mean. I have allready asked this question but then
I had a ClientDataset instead of a Listview.

https://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26274267.html

Is that possible? I hope someone knows the answer and is willing to help me.

Greetings,
Peter Kiers

procedure TForm1.Button1Click(Sender: TObject);
var
  LoopNodes : IDOMNodeList;
  i: Integer;
begin
  XMLDocument1.FileName := '.\MyDB.xml';
  XMLDocument1.Active := True;
  try
    LoopNodes:= XMLDocument1.DOMDocument.getElementsByTagName( 'BG' );

    ListView1.Items.BeginUpdate;
    try
      for i:= 0 to LoopNodes.length -1 do
        with ListView1.Items.add do begin
          Caption:= LoopNodes[i].attributes.getNamedItem('Dt').nodeValue;
          SubItems.Add( LoopNodes[i].attributes.getNamedItem('Tm').nodeValue );
          SubItems.Add( LoopNodes[i].attributes.getNamedItem('Val').nodeValue );
        end;
    finally
      ListView1.Items.EndUpdate;
    end;

  finally
    XMLDocument1.Active := False;
  end;
end;
ASKER CERTIFIED SOLUTION
Avatar of aflarin
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers