I think I've got this resolved. 
I went back to the Learn Utility and found that when my cursor was at one
the database names in the list, the database name was showing in the
Application Viewer Window at position 2-1 every time until I keyed down.
Then it was listed in it's correct position (9,1 or 10,1 and so on).
 
I wrote my code to reflect this and now the script runs correctly every
time. Go figure? 

                Dim FoundHUB As Boolean
                FoundHUB = False
                Do
                    Stable 2
                    If Trim(View(Row:=2, col:=1, length:=7)) = "HUB.CAM"
Then
                        Tab_ ""
                        Tab_ ""
                        Pause "@0,26"
                        Enter "zcus.clinician.menu"
                        FoundHUB = True
                    Else
                        Key "{DOWN}"
                        Stable
                    End If
                Loop Until FoundHUB = True
 
Thanks everyone for your help.
Michelle
 

-----Original Message-----
From: Lew Hundley [mailto:[EMAIL PROTECTED]
Sent: Friday, February 20, 2004 4:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value



Oops, I made a boo-boo. Move the sTitle = Trim... out of the Else and on the
other side of the End If like this.

 

                    Else
                        Key "{DOWN}"
                        Stable

                    End If
                    sTitle = Trim(View(Row:=Row(), col:=1, length:=7))
                Loop Until bProcess = True

 

Sorry

Lew

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Barker-Lacerda ,
Michelle
Sent: Friday, February 20, 2004 1:04 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

 

Thanks I'll try this.

I've never used watch before. I was hoping that in the immediate window I'd
be able to see what my view(row... actually saw, but it only returned
true/false. I'm sure this will be helpful.

 

Thanks again.

Michelle

 

-----Original Message-----
From: Lew Hundley [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 20, 2004 3:57 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

You are down to the nitty gritty debugging.

 

First, don't use the immediate window to see what is happening. I don't
think you are reading it correctly simply because to do your Enter"zcus..."

it has to be in the If, and it can only do that if true, so the View would
have to be HUBCAM.

Try isolating your statements a bit. Use this code.

 

                Dim bProcess As Boolean

                Dim sTitle As String
                bProcess = False

 

                sTitle = Trim(View(Row:=Row(), col:=1, length:=7)) 

 

                Do
                    Stable 2
                    If sTitle = "HUB.CAM" Then
                        Tab_ ""
                        Tab_ ""
                        Pause "@0,26"
                        Enter "zcus.clinician.menu"
                        bProcess = True
                    Else
                        Key "{DOWN}"
                        Stable

                        sTitle = Trim(View(Row:=Row(), col:=1, length:=7))
                    End If
                Loop Until bProcess = True

 

Then add sTitle to your WatchPoints (highlight one of the sTitle and click
on Debug then Add Watch. Make sure your WatchWindow is open at the bottom of
VBA. If not, click on View, then Watch Window. 

 

And put a breakpoint on the first Tab. 

 

This will tell you what is in sTitle in the Watch Window, and if it is
"HUBCAM".  Then put a breakpoint on the "Pause "@0,26" and see where your
cursor really is on your screen. Maybe you need to eliminate one Tab? 

 

Sorry, that is the best I can do without actually running the code.

 

HTH,



Lew

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Barker-Lacerda ,
Michelle
Sent: Friday, February 20, 2004 10:43 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

 

Lew,

This is getting me closer! The Boolean works.

I use the Immediate window when my cursor is on HUB.CAM it still sees my If
statement as False (I've tried with and without the "Trim(..").

Now it tries to enter the string "zcus.clinician.menu" one field below
HUB.CAM (i.e. LAB.CAM) - like it's reading the field above it rather than
where the cursor is positioned. But at least it's executing that part of the
script now rather than going to Else all the time. I'll have to go back and
run to cursor and see what the Row # is listed at when it gets to HUB.CAM
and then below it.

 

Something like this happened before on a different script and I think I used
Key "@_CLEAR" or something like that and it straightened it out.

 

Thanks for your help!

Michelle

 

                Dim bProcess As Boolean
                bProcess = False
                Do
                    Stable 2
                    If Trim(View(Row:=Row(), col:=1, length:=7)) = "HUB.CAM"
Then
                        Tab_ ""
                        Tab_ ""
                        Pause "@0,26"
                        Enter "zcus.clinician.menu"
                        bProcess = True
                    Else
                        Key "{DOWN}"
                        Stable
                    End If
                Loop Until bProcess = True

 

PS... we are Meditech C/S 5.3 SR3

-----Original Message-----
From: Lew Hundley [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 20, 2004 12:06 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

It is your logic, Michelle.

 

After you Key DOWN, you test the loop, and if you are at HUB.CAM, you exit,
so you never get a chance to process HUB.CAM.

One solution is to set a var such as 

 

bProcess As Boolean

 

and set it outside of your loop to FALSE.

 

Then ... Oh what the heck, here is the code...

 

                       bProcess = FALSE

                Do
                    Stable 2 

                    If View(Row:=Row(), col:=1, length:=7) = "HUB.CAM" Then
'never seeing this as true
                        Key "{tab}{tab}"
                        Pause "@0,26"
                        Enter "zcus.clinician.menu"

                        bProcess = TRUE
                    Else
                        Key "{DOWN}"
                        Stable
                    End If
                Loop Until bProcess = TRUE

 

There is probably a more elegant way to do this, but this will work.

 

TKs

Lew

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Barker-Lacerda ,
Michelle
Sent: Friday, February 20, 2004 7:14 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

 

Okay, this worked to end the Do Loop (when it got to HUB.CAM it got out of
the loop and filed the record) - but it still isn't seeing when the If
statement is true.

 

                Do
                    Stable 2        ' also tried Key "@_CLEAR" here because
I have another view statement earlier in the script that deals with any
"user inactive" messages
                    If View(Row:=Row(), col:=1, length:=7) = "HUB.CAM" Then
'never seeing this as true
                        Key "{tab}{tab}"
                        Pause "@0,26"
                        Enter "zcus.clinician.menu"
                    Else
                        Key "{DOWN}"
                        Stable
                    End If
                Loop Until View(Row:=Row(), col:=1, length:=7) = "HUB.CAM"

So the script will Key down through the databases not equal to HUB.CAM
correctly. 

It gets to HUB.CAM and incorrectly goes to the Else statement

Keys down to the next database (i.e. LAB.CAM)

Goes to the End If statement

Gets to the Loop Until statement and then remembers that the last line
before it Keyed down to LAB.CAM was HUB.CAM and exits the Do Loop.

 

I even tried Paul's Boolean suggestion below, and it skipped the If
statement too.

 

Michelle

-----Original Message-----
From: Rich McNeil [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 20, 2004 9:01 AM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

If View(row:=Row(), col:=1, length:=7) = "HUB.CAM" Then 

 

is better...the row:= is necessary since the first default parameter in View
is used in the Windows Connection to specify the window you're reading from.
We've reengineered the View command so that if exactly the first three
parameters are used then they're assumed to be a row,col,length...so
View(row, 1, 7) would also work.

 

Try all this in VBA's immediate window and see what you get.  That's the
easiest way to experiment...stop your script around this area, press control
G, key ?view(row,1,7) and press enter

 

Rich McNeil

Boston Software Systems

866 653 5105

www.bostonworkstation.com <http://www.bostonworkstation.com/> 

 

 

 


  _____  


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Sent: Friday, February 20, 2004 2:35 AM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

Actually I had a flaw in my late night logic.

You don't want to have the  "loop Until View(Row(), col:=1, length:=7) =
"HUB.CAM"    "

 

You want to have something like

Dim FoundOne as Boolean

FoundOne = False

Do

   ' When you find one, set FoundOne to True

 

Loop until FoundOne

 

Now I'm off to bed.

 

Paul



 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Paul
Sent: Thursday, February 19, 2004 11:27 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help: Eval field & key down if not equal to value

 

I don't believe that you can use the Zero with a "view" like you do with a
pause.

 

You might want to try replacing the "0" with row()

Row() returns the current row that the cursor is at.

Your new code would look something like this.....

Pause "@9,1" 
Do

   If View(Row(), col:=1, length:=7) = "HUB.CAM" Then 
       key "{tab}{tab}"

       Pause "@0,26" 
       Enter "zcus.clinician.menu" 
    Else 
       Key "{DOWN}" 

         stable   '  <-- added this.         

    End If 

loop Until View(Row(), col:=1, length:=7) = "HUB.CAM"    



You might want to add some additional logic on the off chance that "HUB.CAM"
is never encountered.

If any of this looks funny, and you'd like me to explain my madness, let me
know, and we can setup a call.

 

Now go to bed and get some sleep!

 

Paul

 

 

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Barker-Lacerda ,
Michelle
Sent: Thursday, February 19, 2004 10:49 PM
To: [EMAIL PROTECTED] COM ([EMAIL PROTECTED])
Subject: [Talk] Help: Eval field & key down if not equal to value

 

Morning! 

I'm trying to get my script to evaluate a field - if the data in that field
isn't equal to a certain string, then the script should key down to the next
field in the list and evaluate it for the same string. This is what I've
tried and it goes to the Else statement each time, even when the If
statement is true. Even though the field position starts at 9,1, I'm using
zero for the row because I don't know at what position the string will read
"HUB.CAM". Could that be the problem?

Pause "@9,1" 
Stable 2 
Do Until View(Row:=0, col:=1, length:=7) = "HUB.CAM" 
   Stable 2 
   If View(Row:=0, col:=1, length:=7) = "HUB.CAM" Then 
       Tab_ "" 
       Pause "@0,22" 
       Tab_ "" 
       Pause "@0,26" 
       Enter "zcus.clinician.menu" 
    Else 
       Key "{DOWN}" 
    End If 
Loop 

I've also tried 

While View(Row:=0, col:=1, length:=7) <> "HUB.CAM" 
   If blah Then 
      blah 
   Else 
      blah 
   End If 
Wend 

Any help is appreciated. 
Thanks 
Michelle 

617-665-3432 
Clinical Application Analyst 
Cambridge Health Alliance 
Information Technology Dept. 
[EMAIL PROTECTED] 
617-546-7770 pgr. 

DISCLAIMER:
This message, including any attachments, is intended for the sole use of the
individual to whom it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law. If
you are not the addressee you are hereby notified that you may not use,
copy, disclose, or distribute to anyone the message or any information
contained in the message. If you have received this message in error, please
immediately advise the sender by reply email and delete this message.

Reply via email to