[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Tdataset lookup example

Posted on 2004-08-21
6
Medium Priority
?
3,192 Views
Last Modified: 2010-04-05
I am looking for a usage example of the TDataset.lookup method (code snippet).  Thanks!
0
Comment
Question by:billseven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 252 total points
ID: 11862512
Hello

  First Paramter is the field you want to search in, second parameter the value, and last parameter the field that you want to have it's value based on search on first parameter

procedure TForm1.Button1Click(Sender: TObject);
var
 V : Variant;
begin
  V := Table1.Lookup('CustNo','1231','Company') ;
  ShowMessage(V);
end;

Remember, Lookup method doesn't move the Pointer to the found record, it's just give you the result, if you would like the pointer to move for the found record, use Located instead of it,

HTH

Regards,
Mohammed
0
 
LVL 12

Assisted Solution

by:esoftbg
esoftbg earned 248 total points
ID: 11862818
download a working example from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21102337.zip

//....................................

procedure TForm1.Button1Click(Sender: TObject);
var
  V: Variant;
  C: Integer;
  A: String;
begin
  V := Table1.Lookup('Company;State', VarArrayOf(['Blue Sports', 'OR']), 'CustNo;Addr1');
  if (VarType(V) in [varNull]) then
    ShowMessage('Search unsuccessful !')
  else
  begin
    C := V[0];
    A := V[1];
    ShowMessage(IntToStr(C) + #10 + A);
  end;
end;
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 13356440
split points
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 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