Search TList

Posted on 2004-08-29
Last Modified: 2010-08-05
I have a TList that is used to store records


   TRecord = ^TCard;

   TCard = packed record

           Item           : Integer;
           Name           : String;
           Limit          : Boolean;
           Period         : String;


   Group  : TList;
   Record : TRecord;

Question - how can i search through each of the records for an item number or a name and return the record number ( ie: user can search by using an item number or the name of a product)?
Question by:foxjax
  • 3
LVL 27

Expert Comment

ID: 11928816
function findrecord(sType : Integer; sName : String; sNumber : Integer) : Integer;
var i : integer;
  i := 0;
  case sType of
    1 : begin  //search by name
            while (i < group.count) and ( <> sName) do inc(i);
    2 : begin  //search by item
            while (i < group.count) and (TRecord.item<> sNumber) do inc(i);
  if (i < group.count) then
    result := i
    result := -1

just from head, just as sample

meikl ;-)
LVL 27

Expert Comment

ID: 11928844
sorry a typo

instead of

also for the item section

meikl ;-)
LVL 27

Accepted Solution

kretzschmar earned 200 total points
ID: 11928846
maybe it must be


just no time for testing

meikl ;-)


Author Comment

ID: 11928912
TRecord(groups[i])^.name made it work - thanks Meikl, i learned a lot from that.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 60
Using idhttp to login to instagram 2 89
Create Database on Android via Delphi dbExpress 3 88
Correct Component for Shopping Cart. 2 104
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now