Link to home
Start Free TrialLog in
Avatar of firekiller15
firekiller15

asked on

append previous result

delphi
given
Table A

Date A(holidayDate)
--------
3/8/2008
3/22/2008
 
Table B
DateB                             result Date I need to meet my gf
------
from 3/1/2008 to 3/31/2008



below is my code

      while( not vA.EOF) do
      begin
        vB.First;
          while (not vB.Eof) do
          begin
           vWeekday := vB.FieldByName('DateB').AsDateTime;
           vWeekday1 := vB.FieldByName('DateB').AsDateTime - 1;
         
         
          if (DayofWeek(vWeekday) = 1)  then  //here weekday is sunday
          begin
            if (DayofWeek(DateA) > DayofWeek(vweekday-3)) and
            (DayofWeek(DateA) > DayofWeek(vWeekday)) and (dateof(vWeekday1) =  dateof(vA.FieldByName('DateA ').AsDateTime))             then
            result := vWeekday - 4
            else
            result := vWeekday - 3;
            vB.edit;
            vB.FieldByName('result').value:= result;
            vB.Post;
           end  ;
           vB.next;
         end;
         vA.Next;
        end;


problem above is that everytime it loop it will rewrite previous calculated  correct result.
is there anyway that the previous calculated result will not be rewrite


Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

This question and this one https://www.experts-exchange.com/questions/23215191/can-return-only-specify-date.html seems very similar. Perhaps you should request the one to be deleted...

Still not sure what you want... Are you wanting to calculate that if a Thursday is a holiday, that you can see her from the Thu to Sun? Or what?
ASKER CERTIFIED SOLUTION
Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial