Solved

comparing records in a database

Posted on 1998-10-01
1
232 Views
Last Modified: 2010-04-06
Before i start thanks to the person who kindly assisted me with my last question.

I am trying to write a procedure that uses findkey to locate a record that part is ok, i then need to however compare the fields with the last record i went to and if there is a difference perform another procedure.

I am able to use findkey and assign the fields i need to compare to variables.  However i need to be able to compare these variables to the last record i did findkey on.

procedure Tproductionfrm.M1Pending; {checks for pending jobs in schedule}
var
  IsColorChange: Boolean;
  IsEndOfRun: Boolean;
  ColorToTest: String;
  ProductToTest: String;
begin
  IsColorChange:= False;
  IsEndOfRun:= False;
  with scheduler.SchT do
     begin
        Open;
        Edit;
        First;
           if FindKey(['Machine 1', 'P']) then {Pending}
           begin
              ProductToTest:=scheduler.SchT.Fields[3].AsString; {product for selected record}
              ColorToTest:=scheduler.SchT.Fields[4].AsString; {colour for selected record}
           end;

     end;
end;

This is the basics at the moment and i have yet to perform any comparison.

any clues?
0
Comment
Question by:npepper
1 Comment
 

Accepted Solution

by:
chrismo earned 100 total points
ID: 1341419
I would say set up two additional variables that store the previous value:

var
  LastProductToTest: string;
  LastColorToTest: string;
begin
  ProductToTest := ...
  ColorToTest := ...

  if (ProductToTest <> LastProductToTest)
     or
     (ColorToTest <> LastColorToTest) then
    DoOtherMethod;

  LastProductToTest := ProductToTest;
  LastColorToTest := ColorToTest;
end;

0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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