These are all good comments. The kind of "red flag" that I see here is
what you could call a naked, one shot "If At". Almost every time I use
If At (and PauseLoop) it's in it's own enclosed, multi-shot Do...Loop.
So your logic would be something like:
Do Until EOF(F)
...
At "" 'this clears the last True At
Enter strEmpNumb
Do
Stable 2
If At("[EMAIL PROTECTED],1") Then
...
End If
If Trim(View(2, 1, 3)) = "" Then
...
End If
If At("@?,?") Then
...
EndIf
Loop Until At("@4,13") 'ready for next employee number
Loop
It looks like your Pausing and Viewing only on rows 1 and 2, so a Key
"@_CLEAR" shouldn't be necessary.
Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOHNSTON,DARON P
Sent: Monday, November 10, 2003 2:38 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] inconsistent If/Else
I would recommend that you put At "" before you check your prompt
location.
This will clear any previously satisfied conditions. Especially since
this
is contained within a Do Loop.
Stable 2
At ""
If At("[EMAIL PROTECTED],1") Then
'your stuff is here
-----Original Message-----
From: Barker, Michelle [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 1:00 PM
To: [EMAIL PROTECTED] COM (E-mail)
Subject: [Talk] inconsistent If/Else
Hi
I have a script that reads from a list of employees and writes their
allowance amounts to the employee's timecard. I need to evaluate two
things:
1. If the script gets an "Employee Terminated" warning and
2. If the employee doesn't have a timecard (no Ctrl Hours posted)
I have written an If/Else statement that firsts looks for the warning:
If
At ("[EMAIL PROTECTED],1) Then..... do some stuff and go on to the next
employee.
If there is no warning it next looks for a blank Ctrl Hour field:
ElseIf
Trim(View(2, 1, 3)) = "" Then.... do some different stuff and go on to
the
next employee.
Finally, if everything is okay it writes the allowance value to the
timecard: Else Tab_ "" ... and do more stuff and go onto the next
employee.
The script is very inconsistent when it runs. Sometimes it goes to the
correct If statement and sometimes it doesn't. In my test population I
had
one employee with no timecard and it put allowances on the card. Another
had
hours and it evaluated it as no timecard. The one that it stumbles over
the
most is when an employee has been termed it goes to the Else statement
and
trys to put allowances on the card.
When I originally wrote this script I didn't have the "Termed" condition
in
it, and I still had a lot of problems getting the script to evaluate the
Ctrl Hour field for consecutive employees. I added a Key "@_CLEAR"
before
the Do Until loop and that seemed to fix it. I've tried added another
one
just before the script enters the employee's ID. It's still
inconsistent.
I've only been able to get the script to run correctly through my entire
test population of 12 employees once.
Attached are the script, the source file, and the exception file from a
successful run. Any suggestions are welcome.
Okay, I'm really just looking to do the least amount of QA at the end of
the
script as I have to!
Thanks
Michelle Barker
617-665-3432
Clinical Application Analyst
CHA Information Technology
[EMAIL PROTECTED]
<<TimecardScript.txt>> <<EmployeeList.prn>> <<ExceptionTCH.txt>>