Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OR statement 2

Status
Not open for further replies.

vzachin

Technical User
Feb 10, 2006
305
US
Hi,

I modified the following coding from skip in post viewthread.cfm?qid=1281018, which works great.
Now I have a different question/problem:
If C,D,M or V appears in Column 4 at the same time AD,AB,AE or ZZ appear, then I do not want <PF5>(update). I want it to go to the next record.
Is there any way to modify this coding?

Code:
Sub TestRow()
For x = 9 To 17
  Select Case Sess0.Screen.GetString(x, 4, 2)
    Case "C ", "D ", "M ", "V ", "AD", "AB", "AE", "ZZ"
    If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
    Sess0.Screen.PutString "NNNNNNN", x, 34
    Sess0.Screen.PutString "N", 3, 58
    Sess0.Screen.SendKeys ("<PF5>")'UPDATE
    Sess0.Screen.WaitHostQuiet (1000)
    End If
    End Select
Next x

End Sub


thanks
zach
 
I'm not sure if this is what you're looking for. But it won't do a <PF5> if there is a "AD", "AB", etc.
Code:
Sub TestRow()
DoPF5 = True
For x = 9 To 17
  Select Case Sess0.Screen.GetString(x, 4, 2)
    Case "C ", "D ", "M ", "V "
      If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
        Sess0.Screen.PutString "NNNNNNN", x, 34
        Sess0.Screen.PutString "N", 3, 58
        If DoPF5 Then
          Sess0.Screen.SendKeys ("<PF5>")'UPDATE
          Sess0.Screen.WaitHostQuiet (1000)
        End If
      End If
    Case "AD", "AB", "AE", "ZZ"
      If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
        DoPF5 = False
        Sess0.Screen.PutString "NNNNNNN", x, 34
        Sess0.Screen.PutString "N", 3, 58
        Sess0.Screen.SendKeys ("<PF5>")'UPDATE
        Sess0.Screen.WaitHostQuiet (1000)
      End If
    End Select
Next x
End Sub

This would read all rows and if an "AD", "AB", etc. is found it won't PF5.
Code:
Sub TestRow()
  ToPF5 = 0
  For x = 9 To 17
    Select Case Sess0.Screen.GetString(x, 4, 2)
      Case "C ", "D ", "M ", "V "
        If ToPF5 = 0 Then ToPF5 = -1
        If Sess0.Screen.GetString(iRow, 34, 7) <> "NNNNNNN" Then _
            Sess0.Screen.PutString "NNNNNNN", iRow, 34
      Case "AD", "AB", "AE", "ZZ"
        ToPF5 = 1
        If Sess0.Screen.GetString(iRow, 34, 7) <> "NNNNNNN" Then _
            Sess0.Screen.PutString "NNNNNNN", iRow, 34
      End Select
  Next x
  If ToPF5 = -1 Then
    Sess0.Screen.PutString "N", 3, 58
    Sess0.Screen.SendKeys ("<PF5>")'UPDATE
    Sess0.Screen.WaitHostQuiet (1000)
  End If
End Sub
 
hi skie,
thanks for the reply.

both codes didn't work for me.
with the 1st code, i had a mixture of C's & AD,AB,AC in column 4 of attachmate but all the rows got updated.
with the 2nd code i tried it with 9 consecutive C's in column 4 but nothing got updated. the irow is always empty.
what could be the problem?

thanks
zach

 
I don't think the first is what you're wanting. Oops on the second; change iRow to x.
 
If C,D,M or V appears in Column 4 at the same time AD,AB,AE or ZZ appear, then I do not want"

Give an example of your data in both instances your describing. As the code is currently only looking at two characters I don't see what you mean by "If C appears at the same time AD appears" If "C" ect appears in column 4 where are we looking for "AD" ect

Select Case Sess0.Screen.GetString(x, 4, 2)
This is your screen row
This is column 4
This is two characters

So how exactly do I get "C"&"AD" in two characters? Show us what this looks like on your screen in instances you want an update and instances you don't.

A CD?
ACD?
A CD?

e.x.

I want it to update if column 4+ looks like this

" AD"
" AB"
" AE"
" ZZ"
"C "
"D "
"M "
"V "

But not if Column 4+ looks like this

"CAD"
"DAB"
"MAE"
"VZZ"



[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Hi Mr Milson,

I hope this makes some sense:

If there is only 1 entry, then change XXXXXX to NNNNNNN


1234567890123456789012345678901234567890
C XXXXXXX

-or

1234567890123456789012345678901234567890
AD XXXXXXX

=======================================

In this case, the C row would be stay XXXXXXX
& the AB row would change to NNNNNNN

1234567890123456789012345678901234567890
C XXXXXXX
AD XXXXXXX

=======================================

In this case, both rows would be changed to NNNNNNN

1234567890123456789012345678901234567890
AD XXXXXXX
AB XXXXXXX
 
hi Skie,

i did try changing the irow to x but the results were like the 1st code.
all the rows got updated.


zach
 
Are they always going to be on two sequencial rows (one below the other)? Does your example include all combinations?

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
In this case, the C row would be stay XXXXXXX
& the AB row would change to NNNNNNN

1234567890123456789012345678901234567890
C XXXXXXX
AD XXXXXXX

Code:
Sub TestRow()
For Row = 9 To 17
  Select Case Sess0.Screen.GetString(Row, 4, 2)
    Case "C "
      If Sess0.Screen.GetString(Row + 1, 4, 2) = "AD" Then
        If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
          Sess0.Screen.PutString "NNNNNNN", Row+ 1 , 34      
          Sess0.Screen.PutString "N", 3, 58
          Sess0.Screen.SendKeys ("<PF5>")'UPDATE
          Sess0.Screen.WaitHostQuiet (1000)
        End If
      End If
  End Select
Next x
End Sub

What if

1234567890123456789012345678901234567890
C XXXXXXX
AD XXXXXXX
AB XXXXXXX


[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
S?B If Sess0.Screen.GetString(Row+1, 34, 7) <> "NNNNNNN" Then


[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
This will run through and look for the doubles first. If it finds one of those, it'll continue, but skip the singles. Otherwise, the singles will get changed.
Code:
Sub TestRow()
  DoCDMV = True
  For x = 9 To 17
    Select Case Sess0.Screen.GetString(x, 4, 2)
      Case "AD", "AB", "AE", "ZZ"
        DoCDMV = False
        If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
          Sess0.Screen.PutString "NNNNNNN", x, 34
          Sess0.Screen.PutString "N", 3, 58
          Sess0.Screen.SendKeys ("<PF5>")'UPDATE
          Sess0.Screen.WaitHostQuiet (1000)
        End If
      End Select
  Next x
  If DoCDMV Then
    For x = 9 To 17
      Select Case Sess0.Screen.GetString(x, 4, 2)
        Case "C ", "D ", "M ", "V "
        If Sess0.Screen.GetString(x, 34, 7) <> "NNNNNNN" Then
          Sess0.Screen.PutString "NNNNNNN", x, 34
          Sess0.Screen.PutString "N", 3, 58
          Sess0.Screen.SendKeys ("<PF5>")'UPDATE
          Sess0.Screen.WaitHostQuiet (1000)
        End If
      End Select
    Next
  End If
End Sub
 
hi skie,

it works! that's amazing.

can you explain this part in the coding:

Code:
Sub TestRow()
[COLOR=#ff0000]
  DoCDMV = True   <======
[/color]
  For x = 9 To 17
  Select Case Sess0.Screen.GetString(x, 4, 2)
  Case "AD", "AB", "AE", "ZZ"
[COLOR=#ff0000]
  DoCDMV = False  <======
[/color]


thanks again
zach
 
DoCDMV is a booleon that when true checks for a C, D, M, or V in x, 4, 2. The value is true at the begining of the sub because no AD, AB, AE, or ZZ has been found and may not be found on the screen. If AD, AB, AE, or ZZ is found, the value is set to false so that it doesn't check for C, D, M or V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top