![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 | |
|
Programmer
Join Date: Feb 2005
Posts: 45
Rep Power: 0
![]() |
Ok, figured this debugger out, seems its looping around the outer loop. I can't see why...
Quote:
|
|
|
|
|
|
|
#22 |
|
Programming Guru
![]() ![]() ![]() |
Just another peek at your tables... You have one instance of a break. In the USA, at least in MS, most employers are required to provide 2 15 min breaks during the day.
So the table would need to be modified if it were to be used by my employer.. A typical shift would be... IN -> BRK_OUT -> BRK_IN -> LUNCH_OUT -> LUNCH_IN -> BRK_OUT -> BRK_IN -> OUT But if you had no intentions of having a second break, ever, the table you have is fine. Just be sure to incorporate flexibility.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#23 | |
|
Programmer
Join Date: Feb 2005
Posts: 45
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#24 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Same deal. Not all paths go through a MoveNext, nor does Execute necessarily get set. Write your approach down in English pseudo-code and manually trace through with every possible set of conditions. In your case, that's not a lot. Use that method with more complicated situations at least at certain defined extremes. Part of design, before you ever code, is to define how you're going to apply test conditions in order to verify that the program works as you intend. Your amorphous ideas do not propagate into the code by osmosis. As far as debugging is concerned, you can always sprinkle output statements liberally throughout the code and observe if records are changing, what ID values are, stuff like that.
When things get hot and heavy and frustrating and seem like mysteries of the universe, unfathomable, just walk out to the barn, sit on the top rail of the corral, and ponder why cowshit looks like a frisbee and horseshit looks like a tennis ball. Some things are more mysterious than programming.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#25 | |
|
Programmer
Join Date: Feb 2005
Posts: 45
Rep Power: 0
![]() |
Quote:
yeah ok i'll do the whole write down pseudo code thingy...and I'll let you know if I figure it out. |
|
|
|
|
|
|
#26 |
|
Programming Guru
![]() ![]() ![]() |
Sorry, I missed that you redesigned the table.
DaWei, you can tell programmers are truely detail oriented... especially when their eyes have glazed over from eyeballing animal shit all day and pondering the reason for the differences in structure. Now that I think about it, rabbits shit marbles... lol.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#27 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
One thing they can't say about me, IR, is that I don't know shit. Deer shit grape clusters.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#28 |
|
Programmer
Join Date: Feb 2005
Posts: 45
Rep Power: 0
![]() |
Snakes shit other snakes...seriously...mine shits these little white balls but every month or so it shits this huge long crap!
Onto the topic though, lol...I'm pulling my hair out now! I've thought of every possibility. Ok, I enter an invalid ID and it goes straight to the else and says that the input is invalid. For my test data I already have a shift for a particular user, their ID, Time in and date is in the record, the time out field is blank. So i've traced the code through with this user in mind and i cannot see whats going wrong. My code as it stands is: procedure Tfrm_clock_In.btn_enterClick(Sender: TObject);
var
Today:TDateTime;
Executed:boolean;
begin
Executed:= false;
Today:= Date;
tbl_employees.Open;
tbl_employees.First;
Repeat
if strtoint(Edit_Employee_ID.text) = tbl_employeesEmployee_ID.value then
begin
tbl_shift.Open;
tbl_shift.First;
repeat
if (strtoint(Edit_Employee_ID.text) = tbl_shiftEmployee_ID.value) and (tbl_shiftDate_.Value = Today) then
begin
if Datetostr(tbl_shiftTime_Out.value)='' then
begin
//sql to updae file with clock out time
showmessage('Clocked Out');
Executed:=true;
end
else Tbl_shift.Next;
end
else tbl_shift.Next;
Until (Executed=true) or (tbl_shift.Eof); //until record update or no shift found
end
else tbl_employees.Next;
Until (Executed=true) or (tbl_employees.Eof);
if tbl_employees.Eof then showmessage('Invalid User ID'); //if don't find a matching employee number then invalid
If tbl_shift.Eof then //if don't find a record to update then create new one
begin
//sql to create a new record
end;
end;Any ideas? |
|
|
|
|
|
#29 | |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
Quote:
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
|
|
|
|
|
|
#30 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Stop and think about what you're doing, and stop and think about providing useful information in your posts.
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|